aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-06-02 10:07:25 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2021-06-03 10:30:53 +0200
commit57ecb25593fb7dd6601e1718773ce52e4247b500 (patch)
treea3356818df8364666df62f2c6167e2138d21afd6 /tools
parent93b5744c2884213225b6e70baaf98e61e8f225a0 (diff)
Set index to QQmlJSMetaProperty when traversing QQmlJS::AST
Along the way, add few Q_ASSERTs to make sure property index is set when it should be set Change-Id: Ifa2d3e08deda65368f47c7071385b0f24dd4cecd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findwarnings.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index 31ecb9a03a..916962a12d 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -689,6 +689,15 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *uiod)
auto property = scope->property(parentPropertyName);
property.setType(QQmlJSScope::ConstPtr(m_currentScope));
+ if (childScope->hasOwnProperty(parentPropertyName)) {
+ Q_ASSERT(childScope->ownProperty(parentPropertyName).index() >= 0);
+ } else {
+ // it's a new property, so must adjust the index. the index is
+ // "outdated" as it's a relative index of scope, not childScope (or
+ // it might even be -1 in theory but this is likely an error)
+ property.setIndex(childScope->ownProperties().size());
+ }
+
// TODO: This is bad. We shouldn't add a new property but rather amend the existing one.
childScope->addOwnProperty(property);
}