[PSI, FE, PSI2IR] Use labels for referencing specific receiver

This commit is contained in:
Anastasiya Shadrina
2021-01-18 19:47:07 +07:00
committed by TeamCityServer
parent aaabf5e1ca
commit 1bcaeabd84
54 changed files with 744 additions and 134 deletions
@@ -188,9 +188,19 @@ public class DescriptorFactory {
@NotNull CallableDescriptor owner,
@Nullable KotlinType receiverParameterType,
@NotNull Annotations annotations
) {
return createExtensionReceiverParameterForCallable(owner, receiverParameterType, annotations, false);
}
@Nullable
public static ReceiverParameterDescriptor createExtensionReceiverParameterForCallable(
@NotNull CallableDescriptor owner,
@Nullable KotlinType receiverParameterType,
@NotNull Annotations annotations,
boolean isContextReceiver
) {
return receiverParameterType == null
? null
: new ReceiverParameterDescriptorImpl(owner, new ExtensionReceiver(owner, receiverParameterType, null), annotations);
: new ReceiverParameterDescriptorImpl(owner, new ExtensionReceiver(owner, receiverParameterType, null, isContextReceiver), annotations);
}
}
@@ -35,14 +35,25 @@ import org.jetbrains.kotlin.types.checker.NewKotlinTypeChecker;
public class ExtensionReceiver extends AbstractReceiverValue implements ImplicitReceiver {
private final CallableDescriptor descriptor;
private final boolean isContextReceiver;
public ExtensionReceiver(
@NotNull CallableDescriptor callableDescriptor,
@NotNull KotlinType receiverType,
@Nullable ReceiverValue original
) {
this(callableDescriptor, receiverType, original, false);
}
public ExtensionReceiver(
@NotNull CallableDescriptor callableDescriptor,
@NotNull KotlinType receiverType,
@Nullable ReceiverValue original,
boolean isContextReceiver
) {
super(receiverType, original);
this.descriptor = callableDescriptor;
this.isContextReceiver = isContextReceiver;
}
@NotNull
@@ -61,4 +72,8 @@ public class ExtensionReceiver extends AbstractReceiverValue implements Implicit
public String toString() {
return getType() + ": Ext {" + descriptor + "}";
}
public boolean isContextReceiver() {
return isContextReceiver;
}
}