aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsscope.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlcompiler/qqmljsscope.cpp')
-rw-r--r--src/qmlcompiler/qqmljsscope.cpp36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp
index 11a2b4a619..1fe22ab5a8 100644
--- a/src/qmlcompiler/qqmljsscope.cpp
+++ b/src/qmlcompiler/qqmljsscope.cpp
@@ -41,20 +41,14 @@ QT_BEGIN_NAMESPACE
template<typename Action>
static bool searchBaseAndExtensionTypes(const QQmlJSScope *type, const Action &check)
{
- const QQmlJSScope *nonCompositeBase = nullptr;
for (const QQmlJSScope *scope = type; scope; scope = scope->baseType().data()) {
- if (check(scope))
- return true;
-
- if (!nonCompositeBase && !scope->isComposite())
- nonCompositeBase = scope;
- }
-
- if (!nonCompositeBase)
- return false;
+ // Extensions override their base types
+ for (const QQmlJSScope *extension = scope->extensionType().data(); extension;
+ extension = extension->baseType().data()) {
+ if (check(extension))
+ return true;
+ }
- for (const QQmlJSScope *scope = nonCompositeBase->extensionType().data(); scope;
- scope = scope->baseType().data()) {
if (check(scope))
return true;
}
@@ -263,23 +257,7 @@ void QQmlJSScope::resolveGroupedScopes()
return false;
};
- const QQmlJSScope *nonCompositeBase = isComposite() ? this : nullptr;
- for (const QQmlJSScope *type = this; type; type = type->baseType().data()) {
- if (findProperty(type))
- break;
-
- if (!nonCompositeBase && !type->isComposite())
- nonCompositeBase = type;
- }
-
- if (!childScope->m_baseType && nonCompositeBase && nonCompositeBase != this) {
- for (const QQmlJSScope *type = nonCompositeBase->extensionType().data(); type;
- type = type->baseType().data()) {
- if (findProperty(type))
- break;
- }
- }
-
+ searchBaseAndExtensionTypes(this, findProperty);
childScope->resolveGroupedScopes();
}
}