Minor, extracted generateLoopBody
This commit is contained in:
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());
|
StackValue conditionValue = gen(expression.getCondition());
|
||||||
conditionValue.condJump(end, true, v);
|
conditionValue.condJump(end, true, v);
|
||||||
|
|
||||||
JetExpression body = expression.getBody();
|
generateLoopBody(expression.getBody());
|
||||||
if (body != null) {
|
|
||||||
gen(body, Type.VOID_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.goTo(condition);
|
v.goTo(condition);
|
||||||
|
|
||||||
@@ -633,10 +630,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
protected abstract void increment(@NotNull Label loopExit);
|
protected abstract void increment(@NotNull Label loopExit);
|
||||||
|
|
||||||
public void body() {
|
public void body() {
|
||||||
JetExpression body = forExpression.getBody();
|
generateLoopBody(forExpression.getBody());
|
||||||
if (body != null) {
|
|
||||||
gen(body, Type.VOID_TYPE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleLeaveVariable(Runnable runnable) {
|
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 class IteratorForLoopGenerator extends AbstractForLoopGenerator {
|
||||||
|
|
||||||
private int iteratorVarIndex;
|
private int iteratorVarIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user