aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint
diff options
context:
space:
mode:
authorEvgeniy A. Dushistov <dushistov@mail.ru>2020-06-17 23:39:28 +0300
committerEvgeniy A. Dushistov <dushistov@mail.ru>2020-06-18 11:21:18 +0300
commitb916c1bffdd4bcaaa6d4d75d2a9efa34a485cff5 (patch)
treede9498b87eb4bdb2156507b126079f627819fc45 /tools/qmllint
parente8d9bc1bcada7d94af5a33d64a9afc860ede5b84 (diff)
qmllint: high level item can also be list
Fixes: QTBUG-84300 Change-Id: I1a9db060cdeb7c4ec10deedab5141a06245a55b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qmllint')
-rw-r--r--tools/qmllint/checkidentifiers.cpp11
-rw-r--r--tools/qmllint/checkidentifiers.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index e1593182ab..32eb4ce025 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -83,12 +83,19 @@ void CheckIdentifiers::printContext(const QQmlJS::SourceLocation &location) cons
}
bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> &members,
- const ScopeTree::ConstPtr &outerScope) const
+ const ScopeTree::ConstPtr &outerScope,
+ const MetaProperty *prop) const
{
+
QStringList expectedNext;
QString detectedRestrictiveName;
QString detectedRestrictiveKind;
+ if (prop != nullptr && prop->isList()) {
+ detectedRestrictiveKind = QLatin1String("list");
+ expectedNext.append(QLatin1String("length"));
+ }
+
ScopeTree::ConstPtr scope = outerScope;
for (const ScopeTree::FieldMember &access : members) {
if (scope.isNull()) {
@@ -319,7 +326,7 @@ bool CheckIdentifiers::operator()(const QHash<QString, ScopeTree::ConstPtr> &qml
.arg(memberAccessBase.m_location.startColumn), Normal);
printContext(memberAccessBase.m_location);
noUnqualifiedIdentifier = false;
- } else if (!checkMemberAccess(memberAccessChain, qmlIt->type())) {
+ } else if (!checkMemberAccess(memberAccessChain, qmlIt->type(), &*qmlIt)) {
noUnqualifiedIdentifier = false;
}
diff --git a/tools/qmllint/checkidentifiers.h b/tools/qmllint/checkidentifiers.h
index 28f8b24c09..36de88a846 100644
--- a/tools/qmllint/checkidentifiers.h
+++ b/tools/qmllint/checkidentifiers.h
@@ -46,7 +46,8 @@ public:
private:
bool checkMemberAccess(const QVector<ScopeTree::FieldMember> &members,
- const ScopeTree::ConstPtr &outerScope) const;
+ const ScopeTree::ConstPtr &outerScope,
+ const MetaProperty *prop = nullptr) const;
void printContext(const QQmlJS::SourceLocation &location) const;
ColorOutput *m_colorOut = nullptr;