From d260e713bdf6a61e49a0944df875bead5b8c46b0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 4 Dec 2020 15:09:25 +0100 Subject: 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 --- tools/qmllint/checkidentifiers.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/qmllint') 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; } -- cgit v1.2.3