Minor, use ResolvedCall#getSuperCallExpression in codegen

This commit is contained in:
Alexander Udalov
2015-09-07 15:47:54 +03:00
parent 8a5e83b947
commit 67d683bc59
@@ -2005,15 +2005,15 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
boolean directToField =
expression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER && contextKind() != OwnerKind.TRAIT_IMPL;
JetExpression r = getReceiverForSelector(expression);
boolean isSuper = r instanceof JetSuperExpression;
JetSuperExpression superExpression =
resolvedCall == null ? null : CallResolverUtilPackage.getSuperCallExpression(resolvedCall.getCall());
propertyDescriptor = context.accessibleDescriptor(propertyDescriptor);
if (directToField) {
receiver = StackValue.receiverWithoutReceiverArgument(receiver);
}
return intermediateValueForProperty(propertyDescriptor, directToField, isSuper ? (JetSuperExpression) r : null, receiver);
return intermediateValueForProperty(propertyDescriptor, directToField, superExpression, receiver);
}
if (descriptor instanceof ClassDescriptor) {
@@ -2555,15 +2555,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
@Nullable
private static JetExpression getReceiverForSelector(PsiElement expression) {
if (expression.getParent() instanceof JetDotQualifiedExpression && !isReceiver(expression)) {
JetDotQualifiedExpression parent = (JetDotQualifiedExpression) expression.getParent();
return parent.getReceiverExpression();
}
return null;
}
@NotNull
private StackValue generateReceiver(@NotNull CallableDescriptor descriptor) {
return context.generateReceiver(descriptor, state, false);
@@ -2663,15 +2654,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
private static boolean isReceiver(PsiElement expression) {
PsiElement parent = expression.getParent();
if (parent instanceof JetQualifiedExpression) {
JetExpression receiverExpression = ((JetQualifiedExpression) parent).getReceiverExpression();
return expression == receiverExpression;
}
return false;
}
public void genVarargs(@NotNull VarargValueArgument valueArgument, @NotNull JetType outType) {
Type type = asmType(outType);
assert type.getSort() == Type.ARRAY;