diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2017-06-14 00:05:30 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-06-20 09:47:36 +0000 |
| commit | b46708183092b10ee94cb364f587121a12e399db (patch) | |
| tree | f2059b30611add8315d42913506b23cdc7741514 /src/qml/compiler/qv4codegen.cpp | |
| parent | 3fef97b427f665c946f7a3983f5900f5951a9e8d (diff) | |
Add support for break and continue
Change-Id: I7750955343276a83c83587b0f40eb87556501b35
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
| -rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 17a2b63bb9..0f62a59187 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2568,7 +2568,7 @@ bool Codegen::visit(BreakStatement *ast) return false; TempScope scope(_function); -#if 0 + if (!_loop) { throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Break outside of loop")); return false; @@ -2587,8 +2587,8 @@ bool Codegen::visit(BreakStatement *ast) } } unwindException(loop->scopeAndFinally); - _block->JUMP(loop->breakBlock); -#endif + bytecodeGenerator->jump().link(*loop->breakLabel); + return false; } @@ -2599,17 +2599,16 @@ bool Codegen::visit(ContinueStatement *ast) TempScope scope(_function); -#if 0 Loop *loop = 0; if (ast->label.isEmpty()) { for (loop = _loop; loop; loop = loop->parent) { - if (loop->continueBlock) + if (loop->continueLabel) break; } } else { for (loop = _loop; loop; loop = loop->parent) { if (loop->labelledStatement && loop->labelledStatement->label == ast->label) { - if (!loop->continueBlock) + if (!loop->continueLabel) loop = 0; break; } @@ -2624,8 +2623,8 @@ bool Codegen::visit(ContinueStatement *ast) return false; } unwindException(loop->scopeAndFinally); - _block->JUMP(loop->continueBlock); -#endif + bytecodeGenerator->jump().link(*loop->continueLabel); + return false; } |
