Minor, extracted generateLoopBody

This commit is contained in:
Denis Zharkov
2014-09-19 16:03:49 +04:00
committed by Alexander Udalov
parent 9e38d207f2
commit 081d2cf95c
@@ -408,10 +408,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
StackValue conditionValue = gen(expression.getCondition());
conditionValue.condJump(end, true, v);
JetExpression body = expression.getBody();
if (body != null) {
gen(body, Type.VOID_TYPE);
}
generateLoopBody(expression.getBody());
v.goTo(condition);
@@ -633,10 +630,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
protected abstract void increment(@NotNull Label loopExit);
public void body() {
JetExpression body = forExpression.getBody();
if (body != null) {
gen(body, Type.VOID_TYPE);
}
generateLoopBody(forExpression.getBody());
}
private void scheduleLeaveVariable(Runnable runnable) {
@@ -676,6 +670,12 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
private void generateLoopBody(@Nullable JetExpression body) {
if (body != null) {
gen(body, Type.VOID_TYPE);
}
}
private class IteratorForLoopGenerator extends AbstractForLoopGenerator {
private int iteratorVarIndex;