aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsimportvisitor.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-11-25 16:02:35 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-11-26 11:57:43 +0100
commit6605839deb36862d9a480df51bd4243369356042 (patch)
tree0bf9745a12543b0b3684908d18bb00008297d660 /src/qmlcompiler/qqmljsimportvisitor.cpp
parent7f5db0b5e3abe6373087af4cea31bd6b2fa72d14 (diff)
qmllint: Support opening the same grouped scope multiple times
Previously, we would only record the first source location for the scope, which produced errors and crashes on bindings to any further locations. Pick-to: 6.2 Fixes: QTBUG-96147 Change-Id: I02e6a551f1eafb31ac7c49d3250d74e5a3842971 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor.cpp')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index 3f83546a42..a5e4f642e0 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -123,6 +123,7 @@ void QQmlJSImportVisitor::enterEnvironment(QQmlJSScope::ScopeType type, const QS
setScopeName(m_currentScope, type, name);
m_currentScope->setIsComposite(true);
m_currentScope->setSourceLocation(location);
+ m_scopesByIrLocation.insert({ location.startLine, location.startColumn }, m_currentScope);
}
bool QQmlJSImportVisitor::enterEnvironmentNonUnique(QQmlJSScope::ScopeType type,
@@ -147,6 +148,7 @@ bool QQmlJSImportVisitor::enterEnvironmentNonUnique(QQmlJSScope::ScopeType type,
return false;
}
// enter found scope
+ m_scopesByIrLocation.insert({ location.startLine, location.startColumn }, *it);
m_currentScope = *it;
return true;
}