diff options
author | Evgeniy A. Dushistov <dushistov@mail.ru> | 2020-08-21 15:50:52 +0300 |
---|---|---|
committer | Evgeniy A. Dushistov <dushistov@mail.ru> | 2020-08-22 15:36:44 +0300 |
commit | a29eb1c15200363a175c1b3a9ad2189b63b9765f (patch) | |
tree | c2dbe0ddf5e6268fdd0f1ae03d7ce0b67f569d0c /tools | |
parent | 538f1b7dd65b1aa6133e1adb8b6d893ab366173e (diff) |
qmllint: fix import java scripts from module
Fixes: QTBUG-86183
Change-Id: I4809cb5a408eb4e668f802cf0d7b7a872d1ed4b7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 10 | ||||
-rw-r--r-- | tools/qmllint/findwarnings.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index c574c166a9..47142e60da 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -129,6 +129,12 @@ FindWarningVisitor::Import FindWarningVisitor::readQmldir(const QString &path) if (!reader.plugins().isEmpty() && QFile::exists(path + SlashPluginsDotQmltypes)) readQmltypes(path + SlashPluginsDotQmltypes, &result.objects); + 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)) }); + } return result; } @@ -146,6 +152,10 @@ void FindWarningVisitor::processImport( import.isAutoImport ? version : import.version); } + for (const auto &it : qAsConst(import.scripts)) { + m_exportedName2Scope.insert(it.first, it.second); + } + // add objects for (auto it = import.objects.begin(); it != import.objects.end(); ++it) { const auto &val = it.value(); diff --git a/tools/qmllint/findwarnings.h b/tools/qmllint/findwarnings.h index 87423db589..be5bc87b53 100644 --- a/tools/qmllint/findwarnings.h +++ b/tools/qmllint/findwarnings.h @@ -64,6 +64,7 @@ private: QHash<QString, ScopeTree::ConstPtr> objects; QList<QQmlDirParser::Import> imports; QList<QQmlDirParser::Component> dependencies; + QList<QPair<QString, ScopeTree::ConstPtr>> scripts; }; ScopeTree::Ptr m_rootScope; |