aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-05-14 16:11:14 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-05-19 11:46:37 +0200
commit4b46972be3c34c1b5506ba7d8c97f4520e2c17d6 (patch)
tree49fdcfb5561a1e892bc602e420e295764cb0cd9b /tools
parentd6c98f192922b3ceab5eb65e651a7f0588b482e9 (diff)
Add a ParentProperty classinfo and use that to find parents
This is more robust than just going by the "parent" name. Task-number: QTBUG-93662 Change-Id: If099733de6ad0f3bb7cb75b8915789f66b554f85 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findwarnings.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index ce78d8285b..cde446c16e 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -603,9 +603,16 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *uiod)
return;
}
- auto property = childScope->property(QStringLiteral("parent"));
- if (!property.propertyName().isEmpty()) {
+ QString parentPropertyName;
+ for (QQmlJSScope::ConstPtr scope = childScope; scope; scope = scope->baseType()) {
+ parentPropertyName = scope->parentPropertyName();
+ if (parentPropertyName.isEmpty())
+ continue;
+
+ auto property = scope->property(parentPropertyName);
property.setType(QQmlJSScope::ConstPtr(m_currentScope));
+
+ // TODO: This is bad. We shouldn't add a new property but rather amend the existing one.
childScope->addOwnProperty(property);
}
}