Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmllsutils.cpp File Reference
#include "qqmllsutils_p.h"
#include <QtLanguageServer/private/qlanguageserverspectypes_p.h>
#include <QtCore/qthreadpool.h>
#include <QtCore/private/qduplicatetracker_p.h>
#include <QtCore/QRegularExpression>
#include <QtQmlDom/private/qqmldomexternalitems_p.h>
#include <QtQmlDom/private/qqmldomtop_p.h>
#include <QtQmlDom/private/qqmldomscriptelements_p.h>
#include <QtQmlDom/private/qqmldom_utils_p.h>
#include <memory>
#include <optional>
#include <stack>
#include <type_traits>
#include <utility>
#include <variant>
+ Include dependency graph for qqmllsutils.cpp:

Go to the source code of this file.

Functions

static QT_BEGIN_NAMESPACE bool isFieldMemberExpression (DomItem &item)
 
static bool isFieldMemberAccess (DomItem &item)
 
static DomItem findJSIdentifierDefinition (DomItem item, const QString &name)
 
static void findUsagesOfNonJSIdentifiers (DomItem item, const QString &name, QList< QQmlLSUtilsLocation > &result)
 
static void findUsagesHelper (DomItem item, const QString &name, QList< QQmlLSUtilsLocation > &result)
 
static QQmlJSScope::ConstPtr findMethodIn (const QQmlJSScope::Ptr &referrerScope, const QString &name)
 
static QQmlJSScope::ConstPtr findPropertyIn (const QQmlJSScope::Ptr &referrerScope, const QString &propertyName, QQmlLSUtilsResolveOptions options)
 
static std::optional< QQmlLSUtilsLocationfindMethodDefinitionOf (DomItem file, QQmlJS::SourceLocation location, const QString &name)
 
static std::optional< QQmlLSUtilsLocationfindPropertyDefinitionOf (DomItem file, QQmlJS::SourceLocation propertyDefinitionLocation, const QString &name)
 

Function Documentation

◆ findJSIdentifierDefinition()

static DomItem findJSIdentifierDefinition ( DomItem  item,
const QString name 
)
static

Definition at line 373 of file qqmllsutils.cpp.

References i, item, and qCDebug.

Referenced by QQmlLSUtils::findDefinitionOf(), findUsagesHelper(), and QQmlLSUtils::resolveExpressionType().

+ Here is the caller graph for this function:

◆ findMethodDefinitionOf()

static std::optional< QQmlLSUtilsLocation > findMethodDefinitionOf ( DomItem  file,
QQmlJS::SourceLocation  location,
const QString name 
)
static

Definition at line 754 of file qqmllsutils.cpp.

References QSet< T >::constEnd(), QSet< T >::constFind(), file, it, method, QQmlLSUtils::sourceLocationToDomItem(), and QQmlJS::Dom::FileLocations::treeOf().

Referenced by QQmlLSUtils::findDefinitionOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findMethodIn()

static QQmlJSScope::ConstPtr findMethodIn ( const QQmlJSScope::Ptr referrerScope,
const QString name 
)
static

Definition at line 555 of file qqmllsutils.cpp.

References QQmlJSScope::parentScope().

Referenced by QQmlLSUtils::findDefinitionOf(), and QQmlLSUtils::resolveExpressionType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findPropertyDefinitionOf()

static std::optional< QQmlLSUtilsLocation > findPropertyDefinitionOf ( DomItem  file,
QQmlJS::SourceLocation  propertyDefinitionLocation,
const QString name 
)
static

Definition at line 775 of file qqmllsutils.cpp.

References file, QQmlLSUtils::sourceLocationToDomItem(), and QQmlJS::Dom::FileLocations::treeOf().

Referenced by QQmlLSUtils::findDefinitionOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findPropertyIn()

static QQmlJSScope::ConstPtr findPropertyIn ( const QQmlJSScope::Ptr referrerScope,
const QString propertyName,
QQmlLSUtilsResolveOptions  options 
)
static

Definition at line 566 of file qqmllsutils.cpp.

References Everything, JustOwner, QQmlJSScope::parentScope(), and property.

Referenced by QQmlLSUtils::findDefinitionOf(), and QQmlLSUtils::resolveExpressionType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findUsagesHelper()

static void findUsagesHelper ( DomItem  item,
const QString name,
QList< QQmlLSUtilsLocation > &  result 
)
static

Definition at line 477 of file qqmllsutils.cpp.

References QQmlJS::Dom::emptyChildrenVisitor(), fileName, findJSIdentifierDefinition(), findUsagesOfNonJSIdentifiers(), item, qCDebug, qCWarning, and QQmlJS::Dom::FileLocations::treeOf().

Referenced by QQmlLSUtils::findUsagesOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findUsagesOfNonJSIdentifiers()

static void findUsagesOfNonJSIdentifiers ( DomItem  item,
const QString name,
QList< QQmlLSUtilsLocation > &  result 
)
static

Definition at line 394 of file qqmllsutils.cpp.

References QSet< T >::constEnd(), QSet< T >::constFind(), QQmlJS::Dom::emptyChildrenVisitor(), QString::isEmpty(), it, item, JustOwner, methodName(), qCDebug, QQmlLSUtils::resolveExpressionType(), and QQmlJS::Dom::FileLocations::treeOf().

Referenced by findUsagesHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFieldMemberAccess()

static bool isFieldMemberAccess ( DomItem item)
static

Helper to check if item is a Field Member Access memberAccess in { <someExpression>.memberAccess}.

Definition at line 45 of file qqmllsutils.cpp.

References isFieldMemberExpression(), item, and parent.

Referenced by QQmlLSUtils::findDefinitionOf(), and QQmlLSUtils::resolveExpressionType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFieldMemberExpression()

static QT_BEGIN_NAMESPACE bool isFieldMemberExpression ( DomItem item)
static

Helper to check if item is a Field Member Expression { <someExpression>.propertyName}.

Definition at line 33 of file qqmllsutils.cpp.

References QQmlJS::Dom::ScriptElements::BinaryExpression::FieldMemberAccess, and item.

Referenced by isFieldMemberAccess(), and QQmlLSUtils::resolveExpressionType().

+ Here is the caller graph for this function: