aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsscope.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-21 16:06:20 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-27 09:23:30 +0100
commited8127cf41951a9ff1d6032c2158e49fdebe51c3 (patch)
tree12e74c92f9c9a9ee940e4bde91ba4132454c1dd8 /src/qmlcompiler/qqmljsscope.cpp
parent23813a319898e8951645a9f9bec5813090fd3a85 (diff)
QmlCompiler: Introduce grouped scopes
This way we can analyze the left hand part of things like "anchors.fill: parent" in qmllint. Change-Id: I0f58312566c3d5062e0fb301c2bad908ab8b8cbb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsscope.cpp')
-rw-r--r--src/qmlcompiler/qqmljsscope.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp
index bea6c29932..0787e1062e 100644
--- a/src/qmlcompiler/qqmljsscope.cpp
+++ b/src/qmlcompiler/qqmljsscope.cpp
@@ -168,6 +168,27 @@ void QQmlJSScope::resolveTypes(const QHash<QString, QQmlJSScope::ConstPtr> &cont
}
}
+void QQmlJSScope::resolveGroupedScopes()
+{
+ for (auto it = m_childScopes.begin(), end = m_childScopes.end(); it != end; ++it) {
+ QQmlJSScope::Ptr childScope = *it;
+ if (childScope->scopeType() != QQmlJSScope::GroupedPropertyScope)
+ continue;
+
+ const QString propertyName = childScope->internalName();
+ for (const QQmlJSScope *type = this; type; type = type->baseType().data()) {
+ auto propertyIt = type->m_properties.find(propertyName);
+ if (propertyIt != type->m_properties.end()) {
+ childScope->m_baseType = QQmlJSScope::ConstPtr(propertyIt->type());
+ childScope->m_baseTypeName = propertyIt->typeName();
+ break;
+ }
+ }
+
+ childScope->resolveGroupedScopes();
+ }
+}
+
QQmlJSScope::ConstPtr QQmlJSScope::findCurrentQMLScope(const QQmlJSScope::ConstPtr &scope)
{
auto qmlScope = scope;