diff options
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 1f1ed42530..c5f841b52f 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -804,14 +804,9 @@ void Codegen::variableDeclaration(VariableDeclaration *ast) assert(expr.code); initializer = *expr; - if (! _env->parent || _function->insideWithOrCatch || _env->compilationMode == QmlBinding) { - // it's global code. - move(_block->NAME(ast->name.toString(), ast->identifierToken.startLine, ast->identifierToken.startColumn), initializer); - } else { - const int index = _env->findMember(ast->name.toString()); - assert(index != -1); - move(_block->LOCAL(index, 0), initializer); - } + int initialized = _block->newTemp(); + move(_block->TEMP(initialized), initializer); + move(identifier(ast->name.toString(), ast->identifierToken.startLine, ast->identifierToken.startColumn), _block->TEMP(initialized)); } void Codegen::variableDeclarationList(VariableDeclarationList *ast) |