diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-25 10:13:26 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-25 15:21:41 +0200 |
commit | 5458f379ac5d5d88dd7f5ddeafd370dbeee3a436 (patch) | |
tree | c032ca45fff744cbe41b55c357a73b4a09eb057c /tools/qmllint | |
parent | 5a88c06665d5c0295691e216740210a5172fcc9e (diff) |
ScopeTree: Remove the "name" property
It was rarely used and only caused confusion. Use internalName instead.
Change-Id: I196b1d77db04a2cb6e3cd0447d34ce9bae0b9cd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmllint')
-rw-r--r-- | tools/qmllint/checkidentifiers.cpp | 2 | ||||
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index 79a861b4c7..c5897b1df3 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -137,7 +137,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> & return false; } - const QString scopeName = scope->name().isEmpty() ? scope->internalName() : scope->name(); + const QString scopeName = scope->internalName(); if (!detectedRestrictiveKind.isEmpty()) { if (expectedNext.contains(access.m_name)) { diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index 3877379a3b..3caf72633a 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -60,7 +60,8 @@ static QQmlDirParser createQmldirParserForFile(const QString &filename) void FindWarningVisitor::enterEnvironment(ScopeType type, const QString &name) { - m_currentScope = ScopeTree::create(type, name, m_currentScope); + m_currentScope = ScopeTree::create(type, m_currentScope); + m_currentScope->setInternalName(name); } void FindWarningVisitor::leaveEnvironment() @@ -484,7 +485,6 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiScriptBinding *uisb) // found id auto expstat = cast<ExpressionStatement *>(uisb->statement); auto identexp = cast<IdentifierExpression *>(expstat->expression); - QString elementName = m_currentScope->name(); m_qmlid2scope.insert(identexp->name.toString(), m_currentScope); if (m_currentScope->isVisualRootScope()) m_rootId = identexp->name.toString(); @@ -564,7 +564,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::IdentifierExpression *idexp) FindWarningVisitor::FindWarningVisitor( QStringList qmltypeDirs, QStringList qmltypesFiles, QString code, QString fileName, bool silent, bool warnUnqualified, bool warnWithStatement, bool warnInheritanceCycle) - : m_rootScope(ScopeTree::create(ScopeType::JSFunctionScope, "global")), + : m_rootScope(ScopeTree::create(ScopeType::JSFunctionScope)), m_qmltypesFiles(std::move(qmltypesFiles)), m_code(std::move(code)), m_rootId(QLatin1String("<id>")), @@ -575,6 +575,7 @@ FindWarningVisitor::FindWarningVisitor( m_warnInheritanceCycle(warnInheritanceCycle), m_importer(QFileInfo(m_filePath).path(), qmltypeDirs) { + m_rootScope->setInternalName("global"); m_currentScope = m_rootScope; // setup color output @@ -810,7 +811,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiObjectDefinition *uiod) do { scope = scope->parentScope(); // TODO: rename method } while (scope->scopeType() != ScopeType::QMLScope); - targetScope = m_rootScopeImports.value(scope->name()); + targetScope = m_rootScopeImports.value(scope->internalName()); } else { // there was a target, check if we already can find it auto scopeIt = m_qmlid2scope.find(target); |