aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-20 15:46:28 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 22:14:30 +0200
commit1c29d63d6045cf9d58cbc0f850de8fa50bf75d09 (patch)
treef233aabd30dd19a93a7bef079c0a34062c9098b5 /src/qml/compiler/qv4codegen.cpp
parent5d7480aff029a8957170bcc36774225d6fb08eb7 (diff)
[new compiler] Fix local variable declarations in binding expressions
Always look up locals by name Change-Id: I2fa14499f6d8749f450bfe2b8a53d684b93bd1dc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 303d001246..bfdbf3b02d 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -805,7 +805,7 @@ void Codegen::variableDeclaration(VariableDeclaration *ast)
assert(expr.code);
initializer = *expr;
- if (! _env->parent || _function->insideWithOrCatch) {
+ if (! _env->parent || _function->insideWithOrCatch || _mode == QmlBinding) {
// it's global code.
move(_block->NAME(ast->name.toString(), ast->identifierToken.startLine, ast->identifierToken.startColumn), initializer);
} else {
@@ -1344,6 +1344,9 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
Environment *e = _env;
V4IR::Function *f = _function;
+ if (_mode == QmlBinding)
+ return _block->NAME(name, line, col);
+
while (f && e->parent) {
if (f->insideWithOrCatch || (f->isNamedExpression && f->name == name))
return _block->NAME(name, line, col);