diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-09-28 12:57:30 +0200 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-10-06 09:40:24 +0200 |
| commit | 6f05fa24665ea700da85f06360e50fb2d4b59861 (patch) | |
| tree | 7bba09edb6fa0b73e1cff0caa88f4a827b9e368a /src | |
| parent | 5a665bc4740106a7c3932506173229ddc8aec8be (diff) | |
QQmlJSScope: Rename js identifier lookup functions
Rename JSIdentifier to ownJSIdentifier and findJSIdentifier to
jsIdentifier.
This is to match the naming convention already in use in QQmlJSScope
for function on methods, properties and bindings on the scope.
Change-Id: Ic45034a4c97801f2776cf35eef980dd568c3160f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/qmlcompiler/qqmljsscope.cpp | 4 | ||||
| -rw-r--r-- | src/qmlcompiler/qqmljsscope_p.h | 4 | ||||
| -rw-r--r-- | src/qmlcompiler/qqmljstypepropagator.cpp | 2 | ||||
| -rw-r--r-- | src/qmlcompiler/qqmljstyperesolver.cpp | 2 | ||||
| -rw-r--r-- | src/qmlls/qqmllsutils.cpp | 14 |
5 files changed, 13 insertions, 13 deletions
diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp index b247ee0570..059d233e48 100644 --- a/src/qmlcompiler/qqmljsscope.cpp +++ b/src/qmlcompiler/qqmljsscope.cpp @@ -286,7 +286,7 @@ bool QQmlJSScope::isComponentRootElement() const { } std::optional<QQmlJSScope::JavaScriptIdentifier> -QQmlJSScope::findJSIdentifier(const QString &id) const +QQmlJSScope::jsIdentifier(const QString &id) const { for (const auto *scope = this; scope; scope = scope->parentScope().data()) { if (scope->m_scopeType == QQmlSA::ScopeType::JSFunctionScope @@ -300,7 +300,7 @@ QQmlJSScope::findJSIdentifier(const QString &id) const return std::optional<JavaScriptIdentifier>{}; } -std::optional<QQmlJSScope::JavaScriptIdentifier> QQmlJSScope::JSIdentifier(const QString &id) const +std::optional<QQmlJSScope::JavaScriptIdentifier> QQmlJSScope::ownJSIdentifier(const QString &id) const { auto it = m_jsIdentifiers.find(id); if (it != m_jsIdentifiers.end()) diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index baebc2f973..9abdb9ca2d 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -386,8 +386,8 @@ public: void setAccessSemantics(AccessSemantics semantics) { m_semantics = semantics; } AccessSemantics accessSemantics() const { return m_semantics; } - std::optional<JavaScriptIdentifier> findJSIdentifier(const QString &id) const; - std::optional<JavaScriptIdentifier> JSIdentifier(const QString &id) const; + std::optional<JavaScriptIdentifier> jsIdentifier(const QString &id) const; + std::optional<JavaScriptIdentifier> ownJSIdentifier(const QString &id) const; QQmlJS::ConstPtrWrapperIterator childScopesBegin() const { return m_childScopes.constBegin(); } QQmlJS::ConstPtrWrapperIterator childScopesEnd() const { return m_childScopes.constEnd(); } diff --git a/src/qmlcompiler/qqmljstypepropagator.cpp b/src/qmlcompiler/qqmljstypepropagator.cpp index 85ff3e78a1..e8f1844a2f 100644 --- a/src/qmlcompiler/qqmljstypepropagator.cpp +++ b/src/qmlcompiler/qqmljstypepropagator.cpp @@ -314,7 +314,7 @@ void QQmlJSTypePropagator::handleUnqualifiedAccess(const QString &name, bool isM if (scope->childScopes().size() == 0) continue; - const auto jsId = scope->childScopes().first()->findJSIdentifier(name); + const auto jsId = scope->childScopes().first()->jsIdentifier(name); if (jsId.has_value() && jsId->kind == QQmlJSScope::JavaScriptIdentifier::Injected) { const QQmlJSScope::JavaScriptIdentifier id = jsId.value(); diff --git a/src/qmlcompiler/qqmljstyperesolver.cpp b/src/qmlcompiler/qqmljstyperesolver.cpp index cf538dcfc9..9a0d50480a 100644 --- a/src/qmlcompiler/qqmljstyperesolver.cpp +++ b/src/qmlcompiler/qqmljstyperesolver.cpp @@ -1369,7 +1369,7 @@ QQmlJSRegisterContent QQmlJSTypeResolver::memberType( scope && (scope->scopeType() == QQmlSA::ScopeType::JSFunctionScope || scope->scopeType() == QQmlSA::ScopeType::JSLexicalScope); scope = scope->parentScope()) { - if (auto ownIdentifier = scope->JSIdentifier(name)) { + if (auto ownIdentifier = scope->ownJSIdentifier(name)) { QQmlJSMetaProperty prop; prop.setPropertyName(name); prop.setTypeName(u"QJSValue"_s); diff --git a/src/qmlls/qqmllsutils.cpp b/src/qmlls/qqmllsutils.cpp index 2d0eaf12f8..8167ce3b37 100644 --- a/src/qmlls/qqmllsutils.cpp +++ b/src/qmlls/qqmllsutils.cpp @@ -409,7 +409,7 @@ static bool findDefinitionFromItem(const DomItem &item, const QString &name) { if (const QQmlJSScope::ConstPtr &scope = item.semanticScope()) { qCDebug(QQmlLSUtilsLog) << "Searching for definition in" << item.internalKindStr(); - if (auto jsIdentifier = scope->JSIdentifier(name)) { + if (auto jsIdentifier = scope->ownJSIdentifier(name)) { qCDebug(QQmlLSUtilsLog) << "Found scope" << scope->baseTypeName(); return true; } @@ -592,7 +592,7 @@ static void findUsagesOfNonJSIdentifiers(const DomItem &item, const QString &nam if (auto scope = current.semanticScope()) { // is the current property shadowed by some JS identifier? ignore current + its children - if (scope->JSIdentifier(name)) { + if (scope->ownJSIdentifier(name)) { return false; } } @@ -667,12 +667,12 @@ static QQmlLSUtilsLocation locationFromJSIdentifierDefinition(const DomItem &def const QString &name) { Q_ASSERT_X(!definitionOfItem.semanticScope().isNull() - && definitionOfItem.semanticScope()->JSIdentifier(name).has_value(), + && definitionOfItem.semanticScope()->ownJSIdentifier(name).has_value(), "QQmlLSUtils::locationFromJSIdentifierDefinition", "JS definition does not actually define the JS identifier. " "Did you obtain definitionOfItem from findJSIdentifierDefinition() ?"); QQmlJS::SourceLocation location = - definitionOfItem.semanticScope()->JSIdentifier(name).value().location; + definitionOfItem.semanticScope()->ownJSIdentifier(name).value().location; QQmlLSUtilsLocation result = { definitionOfItem.canonicalFilePath(), location }; return result; @@ -708,7 +708,7 @@ static void findUsagesHelper( result.append({ fileName, location }); return true; } else if (QQmlJSScope::ConstPtr scope = item.semanticScope(); - scope && scope->JSIdentifier(name)) { + scope && scope->ownJSIdentifier(name)) { // current JS identifier has been redefined, do not visit children return false; } @@ -896,12 +896,12 @@ resolveIdentifierExpressionType(const DomItem &item, QQmlLSUtilsResolveOptions o DomItem definitionOfItem = findJSIdentifierDefinition(item, name); if (definitionOfItem) { Q_ASSERT_X(!definitionOfItem.semanticScope().isNull() - && definitionOfItem.semanticScope()->JSIdentifier(name), + && definitionOfItem.semanticScope()->ownJSIdentifier(name), "QQmlLSUtils::findDefinitionOf", "JS definition does not actually define the JS identifer. " "It should be empty."); auto scope = definitionOfItem.semanticScope(); - auto jsIdentifier = scope->JSIdentifier(name); + auto jsIdentifier = scope->ownJSIdentifier(name); if (jsIdentifier->scope) { return QQmlLSUtilsExpressionType{ name, jsIdentifier->scope.toStrongRef(), QQmlLSUtilsIdentifierType::JavaScriptIdentifier }; |
