Fix continue in for loops. Tests added

This commit is contained in:
Andrey Breslav
2012-08-30 20:14:18 +04:00
parent f0119c7354
commit 59724296d6
3 changed files with 119 additions and 1 deletions
@@ -439,6 +439,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
private void generateForLoop(AbstractForLoopGenerator generator) {
Label loopExit = new Label();
Label loopEntry = new Label();
Label continueLabel = new Label();
generator.beforeLoop();
@@ -446,9 +447,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
generator.conditionAndJump(loopExit);
generator.beforeBody();
blockStackElements.push(new LoopBlockStackElement(loopExit, loopEntry, null));
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.forExpression)));
generator.body();
blockStackElements.pop();
v.mark(continueLabel);
generator.afterBody();
v.goTo(loopEntry);