Refactoring. Remove receiverArgument from ResolutionCandidate.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -103,8 +103,7 @@ fun getExpectedTypePredicate(
|
||||
val resolutionCandidate = ResolutionCandidate.create(
|
||||
call,
|
||||
candidate,
|
||||
call.getDispatchReceiver(),
|
||||
explicitReceiver,
|
||||
null,
|
||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||
null
|
||||
)
|
||||
|
||||
@@ -197,5 +197,5 @@ fun createResolutionCandidatesForConstructors(
|
||||
dispatchReceiver = null
|
||||
}
|
||||
|
||||
return constructors.map { ResolutionCandidate.create(call, it, dispatchReceiver, null, receiverKind, knownSubstitutor) }
|
||||
return constructors.map { ResolutionCandidate.create(call, it, dispatchReceiver, receiverKind, knownSubstitutor) }
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -106,7 +106,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
||||
this.call = candidate.getCall();
|
||||
this.candidateDescriptor = candidate.getDescriptor();
|
||||
this.dispatchReceiver = candidate.getDispatchReceiver();
|
||||
this.extensionReceiver = candidate.getReceiverArgument();
|
||||
this.extensionReceiver = null; // ResolutionCandidate can have only dispatch receiver
|
||||
this.explicitReceiverKind = candidate.getExplicitReceiverKind();
|
||||
this.knownTypeParametersSubstitutor = candidate.getKnownTypeParametersResultingSubstitutor();
|
||||
this.trace = trace;
|
||||
|
||||
+6
-18
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.psi.Call;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.Receiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
|
||||
@@ -29,18 +28,16 @@ public class ResolutionCandidate<D extends CallableDescriptor> {
|
||||
private final D candidateDescriptor;
|
||||
private final TypeSubstitutor knownTypeParametersResultingSubstitutor;
|
||||
private ReceiverValue dispatchReceiver; // receiver object of a method
|
||||
private Receiver receiverArgument; // receiver of an extension function
|
||||
private ExplicitReceiverKind explicitReceiverKind;
|
||||
|
||||
private ResolutionCandidate(
|
||||
@NotNull Call call, @NotNull D descriptor, @Nullable ReceiverValue dispatchReceiver,
|
||||
@Nullable Receiver receiverArgument, @NotNull ExplicitReceiverKind explicitReceiverKind,
|
||||
@NotNull ExplicitReceiverKind explicitReceiverKind,
|
||||
@Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor
|
||||
) {
|
||||
this.call = call;
|
||||
this.candidateDescriptor = descriptor;
|
||||
this.dispatchReceiver = dispatchReceiver;
|
||||
this.receiverArgument = receiverArgument;
|
||||
this.explicitReceiverKind = explicitReceiverKind;
|
||||
this.knownTypeParametersResultingSubstitutor = knownTypeParametersResultingSubstitutor;
|
||||
}
|
||||
@@ -48,23 +45,23 @@ public class ResolutionCandidate<D extends CallableDescriptor> {
|
||||
public static <D extends CallableDescriptor> ResolutionCandidate<D> create(
|
||||
@NotNull Call call, @NotNull D descriptor
|
||||
) {
|
||||
return new ResolutionCandidate<D>(call, descriptor, null, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null);
|
||||
return new ResolutionCandidate<D>(call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null);
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor> ResolutionCandidate<D> create(
|
||||
@NotNull Call call, @NotNull D descriptor, @Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor
|
||||
) {
|
||||
return new ResolutionCandidate<D>(call, descriptor,
|
||||
null, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||
null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||
knownTypeParametersResultingSubstitutor);
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor> ResolutionCandidate<D> create(
|
||||
@NotNull Call call, @NotNull D descriptor, @Nullable ReceiverValue dispatchReceiver,
|
||||
@Nullable Receiver receiverArgument, @NotNull ExplicitReceiverKind explicitReceiverKind,
|
||||
@NotNull ExplicitReceiverKind explicitReceiverKind,
|
||||
@Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor
|
||||
) {
|
||||
return new ResolutionCandidate<D>(call, descriptor, dispatchReceiver, receiverArgument, explicitReceiverKind,
|
||||
return new ResolutionCandidate<D>(call, descriptor, dispatchReceiver, explicitReceiverKind,
|
||||
knownTypeParametersResultingSubstitutor);
|
||||
}
|
||||
|
||||
@@ -72,10 +69,6 @@ public class ResolutionCandidate<D extends CallableDescriptor> {
|
||||
this.dispatchReceiver = dispatchReceiver;
|
||||
}
|
||||
|
||||
public void setReceiverArgument(@Nullable ReceiverValue receiverArgument) {
|
||||
this.receiverArgument = receiverArgument;
|
||||
}
|
||||
|
||||
public void setExplicitReceiverKind(@NotNull ExplicitReceiverKind explicitReceiverKind) {
|
||||
this.explicitReceiverKind = explicitReceiverKind;
|
||||
}
|
||||
@@ -95,11 +88,6 @@ public class ResolutionCandidate<D extends CallableDescriptor> {
|
||||
return dispatchReceiver;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Receiver getReceiverArgument() {
|
||||
return receiverArgument;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ExplicitReceiverKind getExplicitReceiverKind() {
|
||||
return explicitReceiverKind;
|
||||
|
||||
+1
-1
@@ -559,7 +559,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
Call call = CallMaker.makeCall(expression, null, null, expression, Collections.<ValueArgument>emptyList());
|
||||
ResolutionCandidate<ReceiverParameterDescriptor> resolutionCandidate =
|
||||
ResolutionCandidate.create(
|
||||
call, descriptor, null, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null);
|
||||
call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null);
|
||||
|
||||
ResolvedCallImpl<ReceiverParameterDescriptor> resolvedCall =
|
||||
ResolvedCallImpl.create(resolutionCandidate,
|
||||
|
||||
Reference in New Issue
Block a user