From 2bdf631b6d527e30acdeb456905db6f55b6c2ae9 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Thu, 23 Aug 2012 19:14:33 +0400 Subject: [PATCH] Unnecesary fields removed --- .../jet/codegen/ExpressionCodegen.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index d7b98e931b5..be50718f293 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -445,9 +445,6 @@ public class ExpressionCodegen extends JetVisitor { private int iteratorVarIndex; private final ResolvedCall iteratorCall; private final ResolvedCall nextCall; - private final ResolvedCall hasNextCall; - private final Type asmTypeForLoopRange; - private final JetExpression loopRange; private final Type asmTypeForIterator; private final Type asmTypeForNext; @@ -460,12 +457,7 @@ public class ExpressionCodegen extends JetVisitor { private IteratorForLoopGenerator(@NotNull JetForExpression forExpression) { this.forExpression = forExpression; - this.loopRange = forExpression.getLoopRange(); - assert loopRange != null; - - JetType loopRangeType = getNotNull(bindingContext, EXPRESSION_TYPE, loopRange); - this.asmTypeForLoopRange = asmType(loopRangeType); - + JetExpression loopRange = forExpression.getLoopRange(); this.iteratorCall = getNotNull(bindingContext, LOOP_RANGE_ITERATOR_RESOLVED_CALL, loopRange, "No .iterator() function " + DiagnosticUtils.atLocation(loopRange)); @@ -478,11 +470,6 @@ public class ExpressionCodegen extends JetVisitor { LOOP_RANGE_NEXT_RESOLVED_CALL, loopRange, "No next() function " + DiagnosticUtils.atLocation(loopRange)); this.asmTypeForNext = asmType(nextCall.getResultingDescriptor().getReturnType()); - - - this.hasNextCall = getNotNull(bindingContext, - LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, loopRange, - "No hasNext() function " + DiagnosticUtils.atLocation(loopRange)); } @Override @@ -500,8 +487,11 @@ public class ExpressionCodegen extends JetVisitor { public void condition() { // tmp.hasNext() - Call fakeCall = - makeFakeCall(new TransientReceiver(iteratorCall.getResultingDescriptor().getReturnType())); + JetExpression loopRange = forExpression.getLoopRange(); + ResolvedCall hasNextCall = getNotNull(bindingContext, + LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, loopRange, + "No hasNext() function " + DiagnosticUtils.atLocation(loopRange)); + Call fakeCall = makeFakeCall(new TransientReceiver(iteratorCall.getResultingDescriptor().getReturnType())); invokeFunction(fakeCall, StackValue.local(iteratorVarIndex, asmTypeForIterator), hasNextCall); JetType type = hasNextCall.getResultingDescriptor().getReturnType();