diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-29 17:02:37 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-02 15:32:36 +0200 |
commit | d9e98c7f6b6c3331a486cabfe6cd0c07f7bfffe9 (patch) | |
tree | 03d2746e406f96f65bf284b8275a6f0e35a85947 /tools/shared | |
parent | ccd348d4b7423a23b2326c2f42c74719083248ba (diff) |
qmllint: Remove exportedQmlNames from import results
We don't need to expose them anymore.
Change-Id: Ibb25f688459972f718f9a051fbb7265c7e5b5f92
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/shared')
-rw-r--r-- | tools/shared/qmljsimporter.cpp | 25 | ||||
-rw-r--r-- | tools/shared/qmljsimporter.h | 7 |
2 files changed, 11 insertions, 21 deletions
diff --git a/tools/shared/qmljsimporter.cpp b/tools/shared/qmljsimporter.cpp index 4412ec01fd..4dac5466e2 100644 --- a/tools/shared/qmljsimporter.cpp +++ b/tools/shared/qmljsimporter.cpp @@ -137,10 +137,8 @@ void QmlJSImporter::processImport( QmlJSImporter::ImportedTypes *types, const QString &prefix) { - for (auto it = import.scripts.begin(); it != import.scripts.end(); ++it) { - types->importedQmlNames.insert(prefixedName(prefix, it.key()), it.value()); - types->exportedQmlNames.insert(it.key(), it.value()); - } + for (auto it = import.scripts.begin(); it != import.scripts.end(); ++it) + types->qmlNames.insert(prefixedName(prefix, it.key()), it.value()); // add objects for (auto it = import.objects.begin(); it != import.objects.end(); ++it) { @@ -148,10 +146,8 @@ void QmlJSImporter::processImport( types->cppNames.insert(val->internalName(), val); const auto exports = val->exports(); - for (const auto &valExport : exports) { - types->importedQmlNames.insert(prefixedName(prefix, valExport.type()), val); - types->exportedQmlNames.insert(valExport.type(), val); - } + for (const auto &valExport : exports) + types->qmlNames.insert(prefixedName(prefix, valExport.type()), val); } for (auto it = import.objects.begin(); it != import.objects.end(); ++it) { @@ -257,14 +253,14 @@ ScopeTree::Ptr QmlJSImporter::localFile2ScopeTree(const QString &filePath) while (it.hasNext()) { ScopeTree::Ptr scope(localFile2ScopeTree(it.next())); if (!scope->internalName().isEmpty()) - types.importedQmlNames.insert(scope->internalName(), scope); + types.qmlNames.insert(scope->internalName(), scope); } const auto imports = typeReader.imports(); for (const auto &import : imports) importHelper(import.module, &types, import.prefix, import.version); - result->resolveTypes(types.importedQmlNames); + result->resolveTypes(types.qmlNames); return result; } @@ -278,8 +274,7 @@ QmlJSImporter::ImportedTypes QmlJSImporter::importFileOrDirectory( QFileInfo fileInfo(name); if (fileInfo.isFile()) { ScopeTree::Ptr scope(localFile2ScopeTree(fileInfo.canonicalFilePath())); - result.importedQmlNames.insert(prefix.isEmpty() ? scope->internalName() : prefix, scope); - result.exportedQmlNames.insert(scope->internalName(), scope); + result.qmlNames.insert(prefix.isEmpty() ? scope->internalName() : prefix, scope); return result; } @@ -290,10 +285,8 @@ QmlJSImporter::ImportedTypes QmlJSImporter::importFileOrDirectory( }; while (it.hasNext()) { ScopeTree::Ptr scope(localFile2ScopeTree(it.next())); - if (!scope->internalName().isEmpty()) { - result.importedQmlNames.insert(prefixedName(prefix, scope->internalName()), scope); - result.exportedQmlNames.insert(scope->internalName(), scope); - } + if (!scope->internalName().isEmpty()) + result.qmlNames.insert(prefixedName(prefix, scope->internalName()), scope); } return result; diff --git a/tools/shared/qmljsimporter.h b/tools/shared/qmljsimporter.h index 8212afc6d4..960effef40 100644 --- a/tools/shared/qmljsimporter.h +++ b/tools/shared/qmljsimporter.h @@ -50,11 +50,8 @@ public: // C++ names used in qmltypes files for non-composite types QHash<QString, ScopeTree::Ptr> cppNames; - // Names a component intends to export, without prefix - QHash<QString, ScopeTree::Ptr> exportedQmlNames; - - // Names the importing component sees, possibly adding a prefix - QHash<QString, ScopeTree::Ptr> importedQmlNames; + // Names the importing component sees, including any prefixes + QHash<QString, ScopeTree::Ptr> qmlNames; }; QmlJSImporter(const QStringList &importPaths) : m_importPaths(importPaths) {} |