diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-14 12:55:08 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-15 10:44:20 +0200 |
commit | f98c961da6d039621ae40ab6c1a79c4b06efb83f (patch) | |
tree | 0eca1d6c2e19e54795da143ecb65279acd972572 /tools | |
parent | ed9ffa109eb2f242b59443ad430204a90c8028c4 (diff) |
qmllint: Defer resolution of types read from QML files
When importing a directory we most likely don't need all of the files in
the directory. Therefore we now parse them only when they are accessed.
This speeds up the execution and will allow us to process imports
recursively without running into infinite recursion.
Change-Id: I0c79313de792249e6bb86144b5014a7787dbdc5b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmllint/checkidentifiers.cpp | 6 | ||||
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index 6fa26b86ba..b7d331521c 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -82,7 +82,7 @@ void CheckIdentifiers::printContext( static bool walkViaParentAndAttachedScopes(QQmlJSScope::ConstPtr rootType, std::function<bool(QQmlJSScope::ConstPtr)> visit) { - if (rootType == nullptr) + if (rootType.isNull()) return false; std::stack<QQmlJSScope::ConstPtr> stack; stack.push(rootType); @@ -186,7 +186,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, if (it == m_types.end()) { detectedRestrictiveKind = typeName; detectedRestrictiveName = access.m_name; - scope = nullptr; + scope = QQmlJSScope::ConstPtr(); } else { scope = *it; } @@ -304,7 +304,7 @@ bool CheckIdentifiers::operator()( auto it = qmlIDs.find(memberAccessBase.m_name); if (it != qmlIDs.end()) { - if (*it != nullptr) { + if (!it->isNull()) { if (!checkMemberAccess(memberAccessChain, *it)) noUnqualifiedIdentifier = false; continue; diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index 62dce68bb7..962ccaa1c6 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -473,7 +473,7 @@ bool FindWarningVisitor::check() // now that all ids are known, revisit any Connections whose target were perviously unknown for (auto const &outstandingConnection: m_outstandingConnections) { auto targetScope = m_qmlid2scope[outstandingConnection.targetName]; - if (outstandingConnection.scope && targetScope != nullptr) + if (outstandingConnection.scope && !targetScope.isNull()) outstandingConnection.scope->addMethods(targetScope->methods()); QScopedValueRollback<QQmlJSScope::Ptr> rollback(m_currentScope, outstandingConnection.scope); outstandingConnection.uiod->initializer->accept(this); @@ -632,7 +632,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiObjectBinding *uiob) void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectBinding *uiob) { - const auto childScope = m_currentScope; + const QQmlJSScope::ConstPtr childScope = m_currentScope; leaveEnvironment(); QQmlJSMetaProperty property(uiob->qualifiedId->name.toString(), uiob->qualifiedTypeNameId->name.toString(), @@ -736,7 +736,7 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *) const auto it = properties.find(QStringLiteral("parent")); if (it != properties.end()) { auto property = *it; - property.setType(m_currentScope); + property.setType(QQmlJSScope::ConstPtr(m_currentScope)); childScope->addProperty(property); } } |