aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-02 11:17:29 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-02 15:31:59 +0200
commitfebb6ba891616b71476b736d4c583054685c7766 (patch)
tree4a9be0ab41fcb3f844d6460497da2448f78fd9b3 /tools/qmllint
parentb1afde8ada7959b29acb4ac0fae87d7a8ae8aa08 (diff)
qmllint: Fix updating of parent property
We need to check for the baseTypeName, not for the internalName. Also, this is not really the scope's business but a property of how qmllint sets up its scopes. Task-number: QTBUG-87116 Change-Id: I8f0e558a4a5861164c6e85f90e3d88e469ea0769 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru>
Diffstat (limited to 'tools/qmllint')
-rw-r--r--tools/qmllint/findwarnings.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index fb69756415..09ef63d4bd 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -902,7 +902,19 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *)
{
auto childScope = m_currentScope;
leaveEnvironment();
- childScope->updateParentProperty(m_currentScope);
+
+ if (m_currentScope->baseTypeName() == QStringLiteral("Component")
+ || m_currentScope->baseTypeName() == QStringLiteral("program")) {
+ return;
+ }
+
+ const auto properties = childScope->properties();
+ const auto it = properties.find(QStringLiteral("parent"));
+ if (it != properties.end()) {
+ auto property = *it;
+ property.setType(m_currentScope);
+ childScope->addProperty(property);
+ }
}
bool FindWarningVisitor::visit(QQmlJS::AST::FieldMemberExpression *)