From 10396b853a32963f11f395ef675831654a2eb9a6 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 30 Oct 2013 15:35:15 +0400 Subject: [PATCH] Code block reorganization --- .../org/jetbrains/jet/codegen/ExpressionCodegen.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 995c62fcfe0..25715cdb827 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -2269,16 +2269,18 @@ public class ExpressionCodegen extends JetVisitor implem Type type = asmType(calleeContainingClass.getDefaultType()); StackValue result = StackValue.local(0, type); while (cur != null) { + ClassDescriptor thisDescriptor = cur.getThisDescriptor(); + if (!isSuper && thisDescriptor.equals(calleeContainingClass) + || isSuper && DescriptorUtils.isSubclass(thisDescriptor, calleeContainingClass)) { + return castToRequiredTypeOfInterfaceIfNeeded(result, thisDescriptor, calleeContainingClass); + } + if (cur instanceof MethodContext && !(cur instanceof ConstructorContext)) { cur = cur.getParentContext(); } assert cur != null; - ClassDescriptor thisDescriptor = cur.getThisDescriptor(); - if (!isSuper && thisDescriptor.equals(calleeContainingClass) - || isSuper && DescriptorUtils.isSubclass(thisDescriptor, calleeContainingClass)) { - return castToRequiredTypeOfInterfaceIfNeeded(result, thisDescriptor, calleeContainingClass); - } + result = cur.getOuterExpression(result, false);