'replaceTrace' method added to context
This commit is contained in:
Svetlana Isakova
2012-06-07 17:17:23 +04:00
parent 98b40ac6d2
commit 896095b458
3 changed files with 14 additions and 9 deletions
@@ -35,4 +35,9 @@ public class BasicResolutionContext extends ResolutionContext {
private BasicResolutionContext(BindingTrace trace, JetScope scope, Call call, JetType expectedType, DataFlowInfo dataFlowInfo) {
super(trace, scope, call, expectedType, dataFlowInfo);
}
@NotNull
public BasicResolutionContext replaceTrace(@NotNull BindingTrace trace) {
return create(trace, scope, call, expectedType, dataFlowInfo);
}
}
@@ -57,10 +57,10 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
@NotNull
public Collection<CallResolutionContext<D, F>> createCallContexts(@NotNull ResolutionCandidate<D> candidate,
@NotNull ResolutionTask<D, F> task,
@NotNull TemporaryBindingTrace temporaryTrace) {
@NotNull TemporaryBindingTrace candidateTrace) {
ResolvedCallImpl<D> candidateCall = ResolvedCallImpl.create(candidate, temporaryTrace);
return Collections.singleton(CallResolutionContext.create(candidateCall, task, temporaryTrace, task.tracing));
ResolvedCallImpl<D> candidateCall = ResolvedCallImpl.create(candidate, candidateTrace);
return Collections.singleton(CallResolutionContext.create(candidateCall, task, candidateTrace, task.tracing));
}
/**
@@ -82,10 +82,10 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
@NotNull
@Override
public Collection<CallResolutionContext<CallableDescriptor, FunctionDescriptor>> createCallContexts(@NotNull ResolutionCandidate<CallableDescriptor> candidate,
@NotNull ResolutionTask<CallableDescriptor, FunctionDescriptor> task, @NotNull TemporaryBindingTrace temporaryTrace) {
@NotNull ResolutionTask<CallableDescriptor, FunctionDescriptor> task, @NotNull TemporaryBindingTrace candidateTrace) {
if (candidate.getDescriptor() instanceof FunctionDescriptor) {
return super.createCallContexts(candidate, task, temporaryTrace);
return super.createCallContexts(candidate, task, candidateTrace);
}
assert candidate.getDescriptor() instanceof VariableDescriptor;
@@ -94,18 +94,18 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
Call variableCall = stripCallArguments(task);
if (!hasReceiver) {
CallResolutionContext<CallableDescriptor, FunctionDescriptor> context = CallResolutionContext.create(
ResolvedCallImpl.create(candidate, temporaryTrace), task, temporaryTrace, task.tracing, variableCall);
ResolvedCallImpl.create(candidate, candidateTrace), task, candidateTrace, task.tracing, variableCall);
return Collections.singleton(context);
}
Call variableCallWithoutReceiver = stripReceiver(variableCall);
CallResolutionContext<CallableDescriptor, FunctionDescriptor> contextWithReceiver = createContextWithChainedTrace(
candidate, variableCall, temporaryTrace, task);
candidate, variableCall, candidateTrace, task);
ResolutionCandidate<CallableDescriptor> candidateWithoutReceiver = ResolutionCandidate.create(
candidate.getDescriptor(), candidate.getThisObject(), ReceiverDescriptor.NO_RECEIVER, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, false);
CallResolutionContext<CallableDescriptor, FunctionDescriptor> contextWithoutReceiver = createContextWithChainedTrace(
candidateWithoutReceiver, variableCallWithoutReceiver, temporaryTrace, task);
candidateWithoutReceiver, variableCallWithoutReceiver, candidateTrace, task);
contextWithoutReceiver.receiverForVariableAsFunctionSecondCall = variableCall.getExplicitReceiver();
@@ -45,7 +45,7 @@ public class ClassReceiver implements ThisReceiverDescriptor {
@NotNull
@Override
public DeclarationDescriptor getDeclarationDescriptor() {
public ClassDescriptor getDeclarationDescriptor() {
return classDescriptor;
}