aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp3
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp5
-rw-r--r--tools/qmllint/checkidentifiers.cpp7
3 files changed, 9 insertions, 6 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);
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index 6500595c83..b718f0f691 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -355,8 +355,13 @@ bool CheckIdentifiers::operator()(
const auto typeIt = m_types.find(memberAccessBase.m_name);
if (typeIt != m_types.end()) {
- if (!checkMemberAccess(memberAccessChain, *typeIt))
+ if (typeIt->isNull()) {
+ // This is a namespaced import. Check with the full name.
+ if (!memberAccessChain.isEmpty())
+ memberAccessChain.front().m_name.prepend(memberAccessBase.m_name + u'.');
+ } else if (!checkMemberAccess(memberAccessChain, *typeIt)) {
noUnqualifiedIdentifier = false;
+ }
continue;
}