aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-09-07 14:49:04 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-09-08 08:01:25 +0000
commit0a3b69ff19476883ee704fa68b7ec8b4fe449cbe (patch)
treee61a6ea7a2343b352e8244881c77b3cb2076a0d2 /src/qml/compiler/qv4codegen.cpp
parent4b65d9e20b3def434e67ca34d5adc1295bfb0ec7 (diff)
Fix name lookup in QML signal handlers
We need to use an activation context for signal handlers, because parameter names are not explicitly stated, but loaded from the meta- object. However, while compiling we don't know if a function is a signal handler or not, so we need an activation context for all bindings. Change-Id: Ia2fce3bcb1bc1abb11e74fedb429dda9205fa7e5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index f7c89e75fa..82023ce6cc 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2053,8 +2053,8 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
_context->addLocalVar(QStringLiteral("arguments"), Context::VariableDeclaration, AST::VariableDeclaration::FunctionScope);
bool allVarsEscape = _context->hasWith || _context->hasTry || _context->hasDirectEval;
-
- if (!_context->canUseSimpleCall() && _context->compilationMode != GlobalCode && (_context->compilationMode != EvalCode || _context->isStrict)) {
+ if (_context->compilationMode == QmlBinding // we don't really need this for bindings, but we do for signal handlers, and we don't know if the code is a signal handler or not.
+ || (!_context->canUseSimpleCall() && _context->compilationMode != GlobalCode && (_context->compilationMode != EvalCode || _context->isStrict))) {
Instruction::CreateCallContext createContext;
bytecodeGenerator->addInstruction(createContext);
}