From 0a70c80af3959335f77ded2a0d10b7d5c9310b91 Mon Sep 17 00:00:00 2001 From: Michael Bogdanov Date: Tue, 27 Oct 2015 11:02:56 +0300 Subject: [PATCH] Substitute superClassExpression with superCallClass in synthetic accessors --- .../AccessorForCallableDescriptor.java | 4 +- .../AccessorForConstructorDescriptor.kt | 5 +- .../AccessorForFunctionDescriptor.java | 11 ++-- .../AccessorForPropertyDescriptor.java | 31 ++++++------ .../kotlin/codegen/ExpressionCodegen.java | 41 ++++++++------- .../kotlin/codegen/MemberCodegen.java | 4 +- .../kotlin/codegen/PlatformStaticGenerator.kt | 2 +- .../codegen/context/CodegenContext.java | 50 +++++++++---------- 8 files changed, 72 insertions(+), 76 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForCallableDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForCallableDescriptor.java index 0105f98ddd1..d40c5740c0f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForCallableDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForCallableDescriptor.java @@ -19,12 +19,12 @@ package org.jetbrains.kotlin.codegen; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor; -import org.jetbrains.kotlin.psi.KtSuperExpression; +import org.jetbrains.kotlin.descriptors.ClassDescriptor; public interface AccessorForCallableDescriptor { @NotNull T getCalleeDescriptor(); @Nullable - KtSuperExpression getSuperCallExpression(); + ClassDescriptor getSuperCallTarget(); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForConstructorDescriptor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForConstructorDescriptor.kt index 95fd072455b..b4c6cd2418f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForConstructorDescriptor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForConstructorDescriptor.kt @@ -18,14 +18,13 @@ package org.jetbrains.kotlin.codegen import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.KtSuperExpression import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.types.KotlinType public class AccessorForConstructorDescriptor( private val calleeDescriptor: ConstructorDescriptor, containingDeclaration: DeclarationDescriptor, - private val superCallExpression: KtSuperExpression? + private val superCallTarget: ClassDescriptor? ) : AbstractAccessorForFunctionDescriptor(containingDeclaration, Name.special("")), ConstructorDescriptor, AccessorForCallableDescriptor { @@ -37,7 +36,7 @@ public class AccessorForConstructorDescriptor( override fun getReturnType(): KotlinType = super.getReturnType()!! - override fun getSuperCallExpression(): KtSuperExpression? = superCallExpression + override fun getSuperCallTarget(): ClassDescriptor? = superCallTarget init { initialize( diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java index c5d0954e567..0c66a13f97f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java @@ -20,24 +20,23 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.name.Name; -import org.jetbrains.kotlin.psi.KtSuperExpression; import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt; public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDescriptor implements AccessorForCallableDescriptor { private final FunctionDescriptor calleeDescriptor; - private final KtSuperExpression superCallExpression; + private final ClassDescriptor superCallTarget; public AccessorForFunctionDescriptor( @NotNull FunctionDescriptor descriptor, @NotNull DeclarationDescriptor containingDeclaration, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull String nameSuffix ) { super(containingDeclaration, Name.identifier("access$" + nameSuffix)); this.calleeDescriptor = descriptor; - this.superCallExpression = superCallExpression; + this.superCallTarget = superCallTarget; initialize(DescriptorUtils.getReceiverParameterType(descriptor.getExtensionReceiverParameter()), descriptor instanceof ConstructorDescriptor || AnnotationUtilKt.isPlatformStaticInObjectOrClass(descriptor) @@ -57,7 +56,7 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe } @Override - public KtSuperExpression getSuperCallExpression() { - return superCallExpression; + public ClassDescriptor getSuperCallTarget() { + return superCallTarget; } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java index 032c15d3342..a033117fe91 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java @@ -25,7 +25,6 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl; import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl; import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl; import org.jetbrains.kotlin.name.Name; -import org.jetbrains.kotlin.psi.KtSuperExpression; import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.types.KotlinType; @@ -33,7 +32,7 @@ import java.util.Collections; public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor { private final PropertyDescriptor calleeDescriptor; - private final KtSuperExpression superCallExpression; + private final ClassDescriptor superCallTarget; @NotNull private final String nameSuffix; private final boolean withSyntheticGetterAccessor; private final boolean withSyntheticSetterAccessor; @@ -41,13 +40,13 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem public AccessorForPropertyDescriptor( @NotNull PropertyDescriptor property, @NotNull DeclarationDescriptor containingDeclaration, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull String nameSuffix, boolean getterAccessorRequired, boolean setterAccessorRequired ) { this(property, property.getType(), DescriptorUtils.getReceiverParameterType(property.getExtensionReceiverParameter()), - property.getDispatchReceiverParameter(), containingDeclaration, superCallExpression, nameSuffix, + property.getDispatchReceiverParameter(), containingDeclaration, superCallTarget, nameSuffix, getterAccessorRequired, setterAccessorRequired); } @@ -57,10 +56,10 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem @Nullable KotlinType receiverType, @Nullable ReceiverParameterDescriptor dispatchReceiverParameter, @NotNull DeclarationDescriptor containingDeclaration, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull String nameSuffix ) { - this(original, propertyType, receiverType, dispatchReceiverParameter, containingDeclaration, superCallExpression, nameSuffix, true, true); + this(original, propertyType, receiverType, dispatchReceiverParameter, containingDeclaration, superCallTarget, nameSuffix, true, true); } protected AccessorForPropertyDescriptor( @@ -69,7 +68,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem @Nullable KotlinType receiverType, @Nullable ReceiverParameterDescriptor dispatchReceiverParameter, @NotNull DeclarationDescriptor containingDeclaration, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull String nameSuffix, boolean getterAccessorRequired, boolean setterAccessorRequired @@ -79,7 +78,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false); this.calleeDescriptor = original; - this.superCallExpression = superCallExpression; + this.superCallTarget = superCallTarget; this.nameSuffix = nameSuffix; setType(propertyType, Collections.emptyList(), dispatchReceiverParameter, receiverType); @@ -109,10 +108,10 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getCalleeDescriptor().getGetter(); } - @Nullable @Override - public KtSuperExpression getSuperCallExpression() { - return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression(); + @Nullable + public ClassDescriptor getSuperCallTarget() { + return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallTarget(); } } @@ -133,10 +132,10 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getCalleeDescriptor().getSetter(); } - @Nullable @Override - public KtSuperExpression getSuperCallExpression() { - return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression(); + @Nullable + public ClassDescriptor getSuperCallTarget() { + return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallTarget(); } } @@ -147,8 +146,8 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem } @Override - public KtSuperExpression getSuperCallExpression() { - return superCallExpression; + public ClassDescriptor getSuperCallTarget() { + return superCallTarget; } @NotNull diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index f5c19eb10e8..5aba7bf005c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -2008,15 +2008,14 @@ public class ExpressionCodegen extends KtVisitor impleme } boolean directToField = isSyntheticField && contextKind() != OwnerKind.DEFAULT_IMPLS; - KtSuperExpression superExpression = - resolvedCall == null ? null : CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall()); - propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression); + ClassDescriptor superCallTarget = resolvedCall == null ? null : getSuperCallTarget(resolvedCall.getCall()); + propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superCallTarget); if (directToField) { receiver = StackValue.receiverWithoutReceiverArgument(receiver); } - return intermediateValueForProperty(propertyDescriptor, directToField, directToField, superExpression, false, receiver); + return intermediateValueForProperty(propertyDescriptor, directToField, directToField, superCallTarget, false, receiver); } if (descriptor instanceof ClassDescriptor) { @@ -2056,6 +2055,12 @@ public class ExpressionCodegen extends KtVisitor impleme throw new UnsupportedOperationException("don't know how to generate reference " + descriptor); } + @Nullable + private ClassDescriptor getSuperCallTarget(@NotNull Call call) { + KtSuperExpression superExpression = CallResolverUtilKt.getSuperCallExpression(call); + return superExpression == null ? null : getSuperCallLabelTarget(context, superExpression); + } + @Nullable public StackValue findLocalOrCapturedValue(@NotNull DeclarationDescriptor descriptor) { int index = lookupLocalIndex(descriptor); @@ -2134,10 +2139,10 @@ public class ExpressionCodegen extends KtVisitor impleme public StackValue.Property intermediateValueForProperty( @NotNull PropertyDescriptor propertyDescriptor, boolean forceField, - @Nullable KtSuperExpression superExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull StackValue receiver ) { - return intermediateValueForProperty(propertyDescriptor, forceField, false, superExpression, false, receiver); + return intermediateValueForProperty(propertyDescriptor, forceField, false, superCallTarget, false, receiver); } private CodegenContext getBackingFieldContext( @@ -2158,7 +2163,7 @@ public class ExpressionCodegen extends KtVisitor impleme @NotNull PropertyDescriptor propertyDescriptor, boolean forceField, boolean syntheticBackingField, - @Nullable KtSuperExpression superExpression, + @Nullable ClassDescriptor superCallTarget, boolean skipAccessorsForPrivateFieldInOuterClass, StackValue receiver ) { @@ -2178,7 +2183,7 @@ public class ExpressionCodegen extends KtVisitor impleme } boolean isStaticBackingField = DescriptorUtils.isStaticDeclaration(propertyDescriptor) || AsmUtil.isInstancePropertyWithStaticBackingField(propertyDescriptor); - boolean isSuper = superExpression != null; + boolean isSuper = superCallTarget != null; boolean isExtensionProperty = propertyDescriptor.getExtensionReceiverParameter() != null; KotlinType delegateType = getPropertyDelegateType(propertyDescriptor, bindingContext); @@ -2197,7 +2202,7 @@ public class ExpressionCodegen extends KtVisitor impleme if (!skipPropertyAccessors) { //noinspection ConstantConditions propertyDescriptor = (PropertyDescriptor) backingFieldContext.getAccessor( - propertyDescriptor, fieldAccessorKind, delegateType, superExpression + propertyDescriptor, fieldAccessorKind, delegateType, superCallTarget ); assert propertyDescriptor instanceof AccessorForPropertyBackingField : "Unexpected accessor descriptor: " + propertyDescriptor; @@ -2214,15 +2219,14 @@ public class ExpressionCodegen extends KtVisitor impleme if (!skipPropertyAccessors) { if (!couldUseDirectAccessToProperty(propertyDescriptor, true, isDelegatedProperty, context)) { if (isSuper && !isJvmInterface(containingDeclaration)) { - ClassDescriptor owner = getSuperCallLabelTarget(context, superExpression); - CodegenContext c = context.findParentContextWithDescriptor(owner); + CodegenContext c = context.findParentContextWithDescriptor(superCallTarget); assert c != null : "Couldn't find a context for a super-call: " + propertyDescriptor; if (c != context.getParentContext()) { - propertyDescriptor = (PropertyDescriptor) c.getAccessor(propertyDescriptor, superExpression); + propertyDescriptor = (PropertyDescriptor) c.getAccessor(propertyDescriptor, superCallTarget); } } - propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression); + propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superCallTarget); PropertyGetterDescriptor getter = propertyDescriptor.getGetter(); if (getter != null && !hasJvmFieldAnnotation(propertyDescriptor)) { @@ -2355,7 +2359,7 @@ public class ExpressionCodegen extends KtVisitor impleme // $default method is not private, so you need no accessor to call it return usesDefaultArguments(resolvedCall) ? descriptor - : context.accessibleDescriptor(descriptor, CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall())); + : context.accessibleDescriptor(descriptor, getSuperCallTarget(resolvedCall.getCall())); } private static boolean usesDefaultArguments(@NotNull ResolvedCall resolvedCall) { @@ -2377,15 +2381,14 @@ public class ExpressionCodegen extends KtVisitor impleme @NotNull public StackValue invokeFunction(@NotNull Call call, @NotNull ResolvedCall resolvedCall, @NotNull StackValue receiver) { FunctionDescriptor fd = accessibleFunctionDescriptor(resolvedCall); - KtSuperExpression superCallExpression = CallResolverUtilKt.getSuperCallExpression(call); - boolean superCall = superCallExpression != null; + ClassDescriptor superCallTarget = getSuperCallTarget(call); + boolean superCall = superCallTarget != null; if (superCall && !isJvmInterface(fd.getContainingDeclaration())) { - ClassDescriptor owner = getSuperCallLabelTarget(context, superCallExpression); - CodegenContext c = context.findParentContextWithDescriptor(owner); + CodegenContext c = context.findParentContextWithDescriptor(superCallTarget); assert c != null : "Couldn't find a context for a super-call: " + fd; if (c != context.getParentContext()) { - fd = (FunctionDescriptor) c.getAccessor(fd, superCallExpression); + fd = (FunctionDescriptor) c.getAccessor(fd, superCallTarget); } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java index e3cd2d07d84..a7fb5ac1f7d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java @@ -639,7 +639,7 @@ public abstract class MemberCodegen { private static class AccessorForPropertyDescriptorFactory { private final @NotNull PropertyDescriptor property; private final @NotNull DeclarationDescriptor containingDeclaration; - private final @Nullable KtSuperExpression superCallExpression; + private final @Nullable ClassDescriptor superCallTarget; private final @NotNull String nameSuffix; private AccessorForPropertyDescriptor withSyntheticGetterAndSetter = null; @@ -98,12 +97,12 @@ public abstract class CodegenContext { public AccessorForPropertyDescriptorFactory( @NotNull PropertyDescriptor property, @NotNull DeclarationDescriptor containingDeclaration, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, @NotNull String nameSuffix ) { this.property = property; this.containingDeclaration = containingDeclaration; - this.superCallExpression = superCallExpression; + this.superCallTarget = superCallTarget; this.nameSuffix = nameSuffix; } @@ -115,7 +114,7 @@ public abstract class CodegenContext { else if (getterAccessorRequired && !setterAccessorRequired) { if (withSyntheticGetter == null) { withSyntheticGetter = new AccessorForPropertyDescriptor( - property, containingDeclaration, superCallExpression, nameSuffix, + property, containingDeclaration, superCallTarget, nameSuffix, true, false); } return withSyntheticGetter; @@ -123,7 +122,7 @@ public abstract class CodegenContext { else if (!getterAccessorRequired && setterAccessorRequired) { if (withSyntheticSetter == null) { withSyntheticSetter = new AccessorForPropertyDescriptor( - property, containingDeclaration, superCallExpression, nameSuffix, + property, containingDeclaration, superCallTarget, nameSuffix, false, true); } return withSyntheticSetter; @@ -137,7 +136,7 @@ public abstract class CodegenContext { public AccessorForPropertyDescriptor getOrCreateAccessorWithSyntheticGetterAndSetter() { if (withSyntheticGetterAndSetter == null) { withSyntheticGetterAndSetter = new AccessorForPropertyDescriptor( - property, containingDeclaration, superCallExpression, nameSuffix, + property, containingDeclaration, superCallTarget, nameSuffix, true, true); } return withSyntheticGetterAndSetter; @@ -356,16 +355,16 @@ public abstract class CodegenContext { @NotNull private PropertyDescriptor getPropertyAccessor( @NotNull PropertyDescriptor propertyDescriptor, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, boolean getterAccessorRequired, boolean setterAccessorRequired ) { - return getAccessor(propertyDescriptor, FieldAccessorKind.NORMAL, null, superCallExpression, getterAccessorRequired, setterAccessorRequired); + return getAccessor(propertyDescriptor, FieldAccessorKind.NORMAL, null, superCallTarget, getterAccessorRequired, setterAccessorRequired); } @NotNull - public D getAccessor(@NotNull D descriptor, @Nullable KtSuperExpression superCallExpression) { - return getAccessor(descriptor, FieldAccessorKind.NORMAL, null, superCallExpression); + public D getAccessor(@NotNull D descriptor, @Nullable ClassDescriptor superCallTarget) { + return getAccessor(descriptor, FieldAccessorKind.NORMAL, null, superCallTarget); } @SuppressWarnings("unchecked") @@ -374,11 +373,11 @@ public abstract class CodegenContext { @NotNull D possiblySubstitutedDescriptor, @NotNull FieldAccessorKind accessorKind, @Nullable KotlinType delegateType, - @Nullable KtSuperExpression superCallExpression + @Nullable ClassDescriptor superCallTarget ) { // TODO this corresponds to default behavior for properties before fixing KT-9717. Is it Ok in general case? // Does not matter for other descriptor kinds. - return getAccessor(possiblySubstitutedDescriptor, accessorKind, delegateType, superCallExpression, + return getAccessor(possiblySubstitutedDescriptor, accessorKind, delegateType, superCallTarget, /* getterAccessorRequired */ true, /* setterAccessorRequired */ true); } @@ -389,7 +388,7 @@ public abstract class CodegenContext { @NotNull D possiblySubstitutedDescriptor, @NotNull FieldAccessorKind accessorKind, @Nullable KotlinType delegateType, - @Nullable KtSuperExpression superCallExpression, + @Nullable ClassDescriptor superCallTarget, boolean getterAccessorRequired, boolean setterAccessorRequired ) { @@ -401,10 +400,7 @@ public abstract class CodegenContext { } D descriptor = (D) possiblySubstitutedDescriptor.getOriginal(); - AccessorKey key = new AccessorKey( - descriptor, - superCallExpression == null ? null : ExpressionCodegen.getSuperCallLabelTarget(this, superCallExpression) - ); + AccessorKey key = new AccessorKey(descriptor, superCallTarget); // NB should check for property accessor factory first (or change property accessor tracking under propertyAccessorFactory creation) AccessorForPropertyDescriptorFactory propertyAccessorFactory = propertyAccessorFactories.get(key); @@ -420,18 +416,18 @@ public abstract class CodegenContext { String nameSuffix = SyntheticAccessorUtilKt.getAccessorNameSuffix(descriptor, key.superCallLabelTarget, accessorKind); if (descriptor instanceof SimpleFunctionDescriptor) { accessor = new AccessorForFunctionDescriptor( - (FunctionDescriptor) descriptor, contextDescriptor, superCallExpression, nameSuffix + (FunctionDescriptor) descriptor, contextDescriptor, superCallTarget, nameSuffix ); } else if (descriptor instanceof ConstructorDescriptor) { - accessor = new AccessorForConstructorDescriptor((ConstructorDescriptor) descriptor, contextDescriptor, superCallExpression); + accessor = new AccessorForConstructorDescriptor((ConstructorDescriptor) descriptor, contextDescriptor, superCallTarget); } else if (descriptor instanceof PropertyDescriptor) { PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; switch (accessorKind) { case NORMAL: propertyAccessorFactory = new AccessorForPropertyDescriptorFactory((PropertyDescriptor) descriptor, contextDescriptor, - superCallExpression, nameSuffix); + superCallTarget, nameSuffix); propertyAccessorFactories.put(key, propertyAccessorFactory); // Record worst case accessor for accessor methods generation. @@ -511,7 +507,7 @@ public abstract class CodegenContext { @NotNull public D accessibleDescriptor( @NotNull D descriptor, - @Nullable KtSuperExpression superCallExpression + @Nullable ClassDescriptor superCallTarget ) { DeclarationDescriptor enclosing = descriptor.getContainingDeclaration(); if (!isInlineMethodContext() && ( @@ -521,13 +517,13 @@ public abstract class CodegenContext { return descriptor; } - return accessibleDescriptorIfNeeded(descriptor, superCallExpression); + return accessibleDescriptorIfNeeded(descriptor, superCallTarget); } public void recordSyntheticAccessorIfNeeded(@NotNull CallableMemberDescriptor descriptor, @NotNull BindingContext bindingContext) { if (hasThisDescriptor() && Boolean.TRUE.equals(bindingContext.get(NEED_SYNTHETIC_ACCESSOR, descriptor))) { // Not a super call because neither constructors nor private members can be targets of super calls - accessibleDescriptorIfNeeded(descriptor, /* superCallExpression = */ null); + accessibleDescriptorIfNeeded(descriptor, /* superCallTarget = */ null); } } @@ -535,7 +531,7 @@ public abstract class CodegenContext { @NotNull private D accessibleDescriptorIfNeeded( @NotNull D descriptor, - @Nullable KtSuperExpression superCallExpression + @Nullable ClassDescriptor superCallTarget ) { CallableMemberDescriptor unwrappedDescriptor = DescriptorUtils.unwrapFakeOverride(descriptor); @@ -569,14 +565,14 @@ public abstract class CodegenContext { if (!getterAccessorRequired && !setterAccessorRequired) { return descriptor; } - return (D) descriptorContext.getPropertyAccessor(propertyDescriptor, superCallExpression, getterAccessorRequired, setterAccessorRequired); + return (D) descriptorContext.getPropertyAccessor(propertyDescriptor, superCallTarget, getterAccessorRequired, setterAccessorRequired); } else { int flag = getVisibilityAccessFlag(unwrappedDescriptor); if (!isAccessorRequired(flag, unwrappedDescriptor, descriptorContext)) { return descriptor; } - return (D) descriptorContext.getAccessor(descriptor, superCallExpression); + return (D) descriptorContext.getAccessor(descriptor, superCallTarget); } }