diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-06-21 09:20:56 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-06-21 09:18:16 +0000 |
commit | 5c86161fa28e951435a735a299b886fbfbe3bb16 (patch) | |
tree | e895fc011a6b1cddbe27716a43c252d0863817fc | |
parent | b309159cc8f0e075bf325353f505d53404da5bfe (diff) |
Fix for for(... in ...)
Change-Id: I7edb3ec722238c0229ca6d0f850cd15bb1bc6937
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 128a5804ba..6567b9a1ce 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2708,21 +2708,21 @@ bool Codegen::visit(ForEachStatement *ast) BytecodeGenerator::Label body = bytecodeGenerator->label(); - Reference it = Reference::fromTemp(this); - - Reference init = expression(ast->initialiser); - init.store(it); statement(ast->statement); in.link(); + Reference lhs = expression(ast->initialiser); + Instruction::CallBuiltinForeachNextPropertyName nextPropInstr; - nextPropInstr.result = it.asLValue(); + nextPropInstr.result = lhs.asLValue(); nextPropInstr.arg = obj.asRValue(); bytecodeGenerator->addInstruction(nextPropInstr); + lhs.writeBack(); + Reference null = Reference::fromConst(this, QV4::Encode::null()); - bytecodeGenerator->jumpStrictNotEqual(it.asRValue(), null.asRValue()).link(body); + bytecodeGenerator->jumpStrictNotEqual(lhs.asRValue(), null.asRValue()).link(body); end.link(); |