aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint/findunqualified.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-07-24 15:43:49 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-07-25 13:13:16 +0200
commit53e7927fdf56617cfcd3b0e6c9f6db6e0b3d6483 (patch)
treed02e67623473b351c49e5b47cdfc7e770996f0c7 /tools/qmllint/findunqualified.cpp
parentc0e0c755a1c927299607f0af83fadb4a0af6ce20 (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.cpp4
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 &param : 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;