aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-07 11:28:36 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-07 10:32:08 +0000
commitfb2f71137829ba14b2d102ace0e36063daf034a9 (patch)
tree83f92d1836e5a0a71ec4e11a67910b944cf42954 /src
parent06e0ec7cfc6e990c1101a2b4c15452d3c10b6816 (diff)
Don't evaluate the switch expression inside the switch block
Change-Id: I6cbe0610b65c9f9d7381bc1c70ae17e10486d5c3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-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 09f08e8bf2..c90787acc8 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3435,8 +3435,6 @@ bool Codegen::visit(SwitchStatement *ast)
RegisterScope scope(this);
if (ast->block) {
- ControlFlowBlock controlFlow(this, ast->block);
-
BytecodeGenerator::Label switchEnd = bytecodeGenerator->newLabel();
Reference lhs = expression(ast->expression);
@@ -3444,6 +3442,8 @@ bool Codegen::visit(SwitchStatement *ast)
return false;
lhs = lhs.storeOnStack();
+ ControlFlowBlock controlFlow(this, ast->block);
+
// set up labels for all clauses
QHash<Node *, BytecodeGenerator::Label> blockMap;
for (CaseClauses *it = ast->block->clauses; it; it = it->next)