aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-04-14 16:21:17 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2022-04-26 09:05:18 +0200
commit940febf7c555c0e5f78ccb177882a177184f6730 (patch)
treeba6e18e8a142cec78d1b2407d2112f2c7e78505a /tools
parent3340bdf24fbda0b02da2e8d372330996485ae579 (diff)
QQmlJSImportVisitor: always create JSFunctionScope for script bindings
Remove dubious if-statement guarding the environment creation for script bindings Address that script bindings might also exist in the case of: `property var p: ...` which is not a UiScriptBinding but rather a UiPublicMember AST element, thus making `property var p: ...` and `p: ...` equivalent script-binding-wise Change-Id: Ie9dc40e9387a61b40445be5683049c2f3590a061 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmltc/qmltcvisitor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/qmltc/qmltcvisitor.cpp b/tools/qmltc/qmltcvisitor.cpp
index ba85bd8f4f..5d263fdd93 100644
--- a/tools/qmltc/qmltcvisitor.cpp
+++ b/tools/qmltc/qmltcvisitor.cpp
@@ -218,9 +218,10 @@ bool QmltcVisitor::visit(QQmlJS::AST::UiPublicMember *publicMember)
// traversal
const QString notifyName = name + u"Changed"_qs;
- // also check that notify is already a method of m_currentScope
+ // also check that notify is already a method of the scope
{
- const auto methods = m_currentScope->ownMethods(notifyName);
+ auto owningScope = m_savedBindingOuterScope ? m_savedBindingOuterScope : m_currentScope;
+ const auto methods = owningScope->ownMethods(notifyName);
if (methods.size() != 1) {
const QString errorString =
methods.isEmpty() ? u"no signal"_qs : u"too many signals"_qs;