Skip to content

Commit

Permalink
Prepared for extracting superclass.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Gerashchenko authored and Evgeny Gerashchenko committed Feb 13, 2013
1 parent ab99856 commit b5f820c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ protected void increment() {

private class ForInRangeLiteralLoopGenerator extends AbstractForLoopGenerator {
private final RangeCodegenUtil.BinaryCall rangeCall;
private int lastVar;
protected int endVar;

private ForInRangeLiteralLoopGenerator(
@NotNull JetForExpression forExpression,
Expand All @@ -811,18 +811,22 @@ private ForInRangeLiteralLoopGenerator(
public void beforeLoop() {
super.beforeLoop();

endVar = createLoopTempVariable(asmElementType);
storeRangeStartAndEnd();
}

protected void storeRangeStartAndEnd() {
gen(rangeCall.left, asmElementType);
v.store(loopParameterVar, asmElementType);

lastVar = createLoopTempVariable(asmElementType);
gen(rangeCall.right, asmElementType);
v.store(lastVar, asmElementType);
v.store(endVar, asmElementType);
}

@Override
public void conditionAndJump(@NotNull Label loopExit) {
v.load(loopParameterVar, asmElementType);
v.load(lastVar, asmElementType);
v.load(endVar, asmElementType);

int sort = asmElementType.getSort();
switch (sort) {
Expand Down

0 comments on commit b5f820c

Please sign in to comment.