From 1c29d63d6045cf9d58cbc0f850de8fa50bf75d09 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 20 Sep 2013 15:46:28 +0200 Subject: [PATCH] [new compiler] Fix local variable declarations in binding expressions Always look up locals by name Change-Id: I2fa14499f6d8749f450bfe2b8a53d684b93bd1dc Reviewed-by: Lars Knoll --- src/qml/compiler/qv4codegen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);