Write proper start label for loop parameter

This commit is contained in:
Michael Bogdanov
2016-04-08 11:19:17 +03:00
parent 441a442f34
commit a6044c81ff
3 changed files with 18 additions and 4 deletions
@@ -627,7 +627,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// for (e : E in c) {...}
protected final KtForExpression forExpression;
private final Label bodyStart = new Label();
private final Label loopParameterStartLabel = new Label();
private final Label bodyEnd = new Label();
private final List<Runnable> leaveVariableTasks = Lists.newArrayList();
@@ -667,7 +667,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
myFrameMap.leave(parameterDescriptor);
v.visitLocalVariable(parameterDescriptor.getName().asString(),
loopParameterType.getDescriptor(), null,
bodyStart, bodyEnd,
loopParameterStartLabel, bodyEnd,
loopParameterVar);
}
});
@@ -687,9 +687,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
public abstract void checkPreCondition(@NotNull Label loopExit);
public void beforeBody() {
v.mark(bodyStart);
assignToLoopParameter();
v.mark(loopParameterStartLabel);
if (forExpression.getLoopParameter() == null) {
KtDestructuringDeclaration multiParameter = forExpression.getDestructuringParameter();