aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-12-04 15:09:25 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-12-05 21:48:48 +0100
commitd260e713bdf6a61e49a0944df875bead5b8c46b0 (patch)
treedd709231b06c3d909e135125ea39f0293a788148 /src/qmlcompiler
parentd297723fe6b8ebad6c87d0e47dc795e8e48943a4 (diff)
QmlCompiler: Don't add imports with "as" to the context
That is wrong. The context does not contain such objects. Instead, mark the names as namespaces in the imports by giving them an empty type. Change-Id: Ie9d0bba592863878d2220cee59be369ba2534f17 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp3
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp5
2 files changed, 3 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index 73bc63e0fa..5b693f5c72 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -209,6 +209,9 @@ void QQmlJSImporter::processImport(
QQmlJSImporter::AvailableTypes *types,
const QString &prefix)
{
+ if (!prefix.isEmpty())
+ types->qmlNames.insert(prefix, {}); // Empty type means "this is the prefix"
+
for (auto it = import.scripts.begin(); it != import.scripts.end(); ++it)
types->qmlNames.insert(prefixedName(prefix, it.key()), it.value());
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index b0fe5dc1ba..96c5b3b369 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -324,11 +324,6 @@ bool QQmlJSImportVisitor::visit(QQmlJS::AST::UiImport *import)
}
QString path {};
- if (!import->importId.isEmpty()) {
- // TODO: do not put imported ids into the same space as qml IDs
- const QString importId = import->importId.toString();
- m_scopesById.insert(importId, m_rootScopeImports.value(importId));
- }
auto uri = import->importUri;
while (uri) {
path.append(uri->name);