diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-07-24 15:43:49 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-07-25 13:13:16 +0200 |
commit | 53e7927fdf56617cfcd3b0e6c9f6db6e0b3d6483 (patch) | |
tree | d02e67623473b351c49e5b47cdfc7e770996f0c7 /tools/qmllint/findunqualified.cpp | |
parent | c0e0c755a1c927299607f0af83fadb4a0af6ce20 (diff) |
qmllint: Improve signal handler recommendations
- Fix the case where multiple unqualified accesses would be mapped to
the same signal (wrong in all but one cases), as the event parameter
has the same name and we were using a QHash. Fixed by using QMultiHash
and searching for the matching signal handler (by location)
- Recommend arrow functions for single line event handlers
Change-Id: I3cbb85fe0e49b454908ca03b4c86318ef02e364c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmllint/findunqualified.cpp')
-rw-r--r-- | tools/qmllint/findunqualified.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp index 3abdfcfa53..e6a72df44c 100644 --- a/tools/qmllint/findunqualified.cpp +++ b/tools/qmllint/findunqualified.cpp @@ -503,7 +503,9 @@ bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::UiScriptBinding *uisb) } else { auto method = m_currentScope->methods()[signal]; for (auto const ¶m : method.parameterNames()) { - m_currentScope->insertSignalIdentifier(param, method, uisb->statement->firstSourceLocation()); + auto firstSourceLocation = uisb->statement->firstSourceLocation(); + bool hasMultilineStatementBody = uisb->statement->lastSourceLocation().startLine > firstSourceLocation.startLine; + m_currentScope->insertSignalIdentifier(param, method, firstSourceLocation, hasMultilineStatementBody); } } return true; |