diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-15 17:42:18 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-13 16:54:27 +0100 |
commit | d31bb553b543cc43591c31a35d054504aa756bdc (patch) | |
tree | 26542e4fe4783a9c23c48bd5afec0ffd2ba74ec3 /tools | |
parent | 01b865411d945960cb00b51a0078549eb3dd38e8 (diff) |
qmllint: Consider attached properties
We cannot figure out who attached properties to what, therefore we
consider any uppercase property we cannot locate as a potential attached
property.
Change-Id: I60508b9e4e038a51b87c56edf0796ac492aa3fa0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmllint/scopetree.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/qmllint/scopetree.cpp b/tools/qmllint/scopetree.cpp index 6c122f0368..2ca3ed9a67 100644 --- a/tools/qmllint/scopetree.cpp +++ b/tools/qmllint/scopetree.cpp @@ -230,6 +230,16 @@ bool ScopeTree::checkMemberAccess( type = types.value(type->superclassName()); } + if (access->m_name.front().isUpper() && scope->scopeType() == ScopeType::QMLScope) { + // may be an attached type + const auto it = types.find(access->m_name); + if (it != types.end() && !(*it)->attachedTypeName().isEmpty()) { + const auto attached = types.find((*it)->attachedTypeName()); + if (attached != types.end()) + return checkMemberAccess(code, access.get(), attached->get(), types, colorOut); + } + } + colorOut.write("Warning: ", Warning); colorOut.write(QString::fromLatin1( "Property \"%1\" not found on type \"%2\" at %3:%4\n") |