diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-24 13:23:32 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-25 15:21:41 +0200 |
commit | 88fd9c3996fd0280be639ad116ebc3a1b30ae0c4 (patch) | |
tree | 24fa1ece436e8394869f078380d1c6a366d0e521 /tools | |
parent | 25a1ad9b654a9a7b0b04d8b63a020162c18b5e20 (diff) |
qmllint: Keep scopes mutable until all the imports are resolved
Change-Id: I48601019d0e200eae9d52c3a9db45913cdd9d0f8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 14 | ||||
-rw-r--r-- | tools/qmllint/findwarnings.h | 6 | ||||
-rw-r--r-- | tools/shared/typedescriptionreader.cpp | 2 | ||||
-rw-r--r-- | tools/shared/typedescriptionreader.h | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index 715da12ca1..9686194c92 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -71,8 +71,8 @@ void FindWarningVisitor::leaveEnvironment() static const QLatin1String SlashQmldir = QLatin1String("/qmldir"); static const QLatin1String SlashPluginsDotQmltypes = QLatin1String("/plugins.qmltypes"); -void FindWarningVisitor::Importer::readQmltypes(const QString &filename, - QHash<QString, ScopeTree::ConstPtr> *objects) +void FindWarningVisitor::Importer::readQmltypes( + const QString &filename, QHash<QString, ScopeTree::Ptr> *objects) { const QFileInfo fileInfo(filename); if (!fileInfo.exists()) { @@ -121,7 +121,7 @@ FindWarningVisitor::Importer::Import FindWarningVisitor::Importer::readQmldir(co ComponentVersion(it->version)); } for (auto it = qmlComponents.begin(), end = qmlComponents.end(); it != end; ++it) - result.objects.insert( it.key(), ScopeTree::ConstPtr(it.value())); + result.objects.insert(it.key(), it.value()); if (!reader.plugins().isEmpty() && QFile::exists(path + SlashPluginsDotQmltypes)) readQmltypes(path + SlashPluginsDotQmltypes, &result.objects); @@ -129,8 +129,7 @@ FindWarningVisitor::Importer::Import FindWarningVisitor::Importer::readQmldir(co const auto scripts = reader.scripts(); for (const auto &script : scripts) { const QString filePath = path + QLatin1Char('/') + script.fileName; - result.scripts.push_back( - { script.nameSpace, ScopeTree::ConstPtr(localFile2ScopeTree(filePath)) }); + result.scripts.push_back({ script.nameSpace, localFile2ScopeTree(filePath) }); } return result; } @@ -264,14 +263,15 @@ QHash<QString, ScopeTree::ConstPtr> FindWarningVisitor::Importer::importFileOrDi name = QDir(m_currentDir).filePath(name); if (QFileInfo(name).isFile()) { - m_exportedName2Scope.insert(prefix, ScopeTree::ConstPtr(localFile2ScopeTree(name))); + ScopeTree::Ptr scope(localFile2ScopeTree(name)); + m_exportedName2Scope.insert(prefix, scope); result.swap(m_exportedName2Scope); return result; } QDirIterator it { name, QStringList() << QLatin1String("*.qml"), QDir::NoFilter }; while (it.hasNext()) { - ScopeTree::ConstPtr scope(localFile2ScopeTree(it.next())); + ScopeTree::Ptr scope(localFile2ScopeTree(it.next())); if (!scope->className().isEmpty()) m_exportedName2Scope.insert(prefixedName(prefix, scope->className()), scope); } diff --git a/tools/qmllint/findwarnings.h b/tools/qmllint/findwarnings.h index 315c72aa47..edc4d46272 100644 --- a/tools/qmllint/findwarnings.h +++ b/tools/qmllint/findwarnings.h @@ -82,16 +82,16 @@ private: private: struct Import { - QHash<QString, ScopeTree::ConstPtr> objects; + QHash<QString, ScopeTree::Ptr> objects; QList<QQmlDirParser::Import> imports; QList<QQmlDirParser::Component> dependencies; - QList<QPair<QString, ScopeTree::ConstPtr>> scripts; + QList<QPair<QString, ScopeTree::Ptr>> scripts; }; void importHelper(const QString &module, const QString &prefix = QString(), QTypeRevision version = QTypeRevision()); void processImport(const QString &prefix, const Import &import, QTypeRevision version); - void readQmltypes(const QString &filename, QHash<QString, ScopeTree::ConstPtr> *objects); + void readQmltypes(const QString &filename, QHash<QString, ScopeTree::Ptr> *objects); Import readQmldir(const QString &dirname); ScopeTree::Ptr localFile2ScopeTree(const QString &filePath); diff --git a/tools/shared/typedescriptionreader.cpp b/tools/shared/typedescriptionreader.cpp index 5dded4502c..ae2e481397 100644 --- a/tools/shared/typedescriptionreader.cpp +++ b/tools/shared/typedescriptionreader.cpp @@ -52,7 +52,7 @@ QString toString(const UiQualifiedId *qualifiedId, QChar delimiter = QLatin1Char } bool TypeDescriptionReader::operator()( - QHash<QString, ScopeTree::ConstPtr> *objects, + QHash<QString, ScopeTree::Ptr> *objects, QStringList *dependencies) { Engine engine; diff --git a/tools/shared/typedescriptionreader.h b/tools/shared/typedescriptionreader.h index 2c86282163..bf0fd43eae 100644 --- a/tools/shared/typedescriptionreader.h +++ b/tools/shared/typedescriptionreader.h @@ -55,7 +55,7 @@ public: : m_fileName(std::move(fileName)), m_source(std::move(data)) {} bool operator()( - QHash<QString, ScopeTree::ConstPtr> *objects, + QHash<QString, ScopeTree::Ptr> *objects, QStringList *dependencies); QString errorMessage() const { return m_errorMessage; } @@ -88,7 +88,7 @@ private: QString m_source; QString m_errorMessage; QString m_warningMessage; - QHash<QString, ScopeTree::ConstPtr> *m_objects = nullptr; + QHash<QString, ScopeTree::Ptr> *m_objects = nullptr; QStringList *m_dependencies = nullptr; }; |