BasicResolutionContext renamed to BasicCallResolutionContext
This commit is contained in:
+8
-11
@@ -23,9 +23,9 @@ import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
|
|
||||||
public class BasicResolutionContext extends CallResolutionContext<BasicResolutionContext> {
|
public class BasicCallResolutionContext extends CallResolutionContext<BasicCallResolutionContext> {
|
||||||
@NotNull
|
@NotNull
|
||||||
public static BasicResolutionContext create(
|
public static BasicCallResolutionContext create(
|
||||||
@NotNull BindingTrace trace,
|
@NotNull BindingTrace trace,
|
||||||
@NotNull JetScope scope,
|
@NotNull JetScope scope,
|
||||||
@NotNull Call call,
|
@NotNull Call call,
|
||||||
@@ -33,20 +33,17 @@ public class BasicResolutionContext extends CallResolutionContext<BasicResolutio
|
|||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
boolean namespacesAllowed
|
boolean namespacesAllowed
|
||||||
) {
|
) {
|
||||||
return new BasicResolutionContext(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
return new BasicCallResolutionContext(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BasicResolutionContext(BindingTrace trace, JetScope scope, Call call, JetType expectedType, DataFlowInfo dataFlowInfo, boolean namespacesAllowed) {
|
private BasicCallResolutionContext(
|
||||||
|
BindingTrace trace, JetScope scope, Call call, JetType expectedType, DataFlowInfo dataFlowInfo, boolean namespacesAllowed
|
||||||
|
) {
|
||||||
super(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
super(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public BasicResolutionContext replaceTrace(@NotNull BindingTrace trace) {
|
|
||||||
return create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BasicResolutionContext replace(
|
protected BasicCallResolutionContext replace(
|
||||||
@NotNull BindingTrace trace,
|
@NotNull BindingTrace trace,
|
||||||
@NotNull JetScope scope,
|
@NotNull JetScope scope,
|
||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@@ -57,7 +54,7 @@ public class BasicResolutionContext extends CallResolutionContext<BasicResolutio
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BasicResolutionContext self() {
|
protected BasicCallResolutionContext self() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.Call;
|
import org.jetbrains.jet.lang.psi.Call;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.CallResolutionContext;
|
|
||||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallImpl;
|
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionTask;
|
import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionTask;
|
||||||
@@ -63,7 +62,7 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D, D> create(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D, D> create(
|
||||||
@NotNull CallResolutionContext context, @NotNull TracingStrategy tracing,
|
@NotNull BasicCallResolutionContext context, @NotNull TracingStrategy tracing,
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall) {
|
@NotNull ResolvedCallImpl<D> candidateCall) {
|
||||||
return new CallCandidateResolutionContext<D, D>(candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
return new CallCandidateResolutionContext<D, D>(candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2012 JetBrains s.r.o.
|
* Copyright 2010-2013 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -37,7 +37,7 @@ public abstract class CallResolutionContext<Context extends CallResolutionContex
|
|||||||
this.call = call;
|
this.call = call;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicResolutionContext toBasic() {
|
public BasicCallResolutionContext toBasic() {
|
||||||
return BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
return BasicCallResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public OverloadResolutionResults<VariableDescriptor> resolveSimpleProperty(@NotNull BasicResolutionContext context) {
|
public OverloadResolutionResults<VariableDescriptor> resolveSimpleProperty(@NotNull BasicCallResolutionContext context) {
|
||||||
JetExpression calleeExpression = context.call.getCalleeExpression();
|
JetExpression calleeExpression = context.call.getCalleeExpression();
|
||||||
assert calleeExpression instanceof JetSimpleNameExpression;
|
assert calleeExpression instanceof JetSimpleNameExpression;
|
||||||
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression) calleeExpression;
|
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression) calleeExpression;
|
||||||
@@ -107,7 +107,7 @@ public class CallResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public OverloadResolutionResults<FunctionDescriptor> resolveCallWithGivenName(
|
public OverloadResolutionResults<FunctionDescriptor> resolveCallWithGivenName(
|
||||||
@NotNull BasicResolutionContext context,
|
@NotNull BasicCallResolutionContext context,
|
||||||
@NotNull final JetReferenceExpression functionReference,
|
@NotNull final JetReferenceExpression functionReference,
|
||||||
@NotNull Name name) {
|
@NotNull Name name) {
|
||||||
List<ResolutionTask<CallableDescriptor, FunctionDescriptor>> tasks =
|
List<ResolutionTask<CallableDescriptor, FunctionDescriptor>> tasks =
|
||||||
@@ -124,11 +124,11 @@ public class CallResolver {
|
|||||||
@NotNull JetType expectedType,
|
@NotNull JetType expectedType,
|
||||||
@NotNull DataFlowInfo dataFlowInfo
|
@NotNull DataFlowInfo dataFlowInfo
|
||||||
) {
|
) {
|
||||||
return resolveFunctionCall(BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, false));
|
return resolveFunctionCall(BasicCallResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public OverloadResolutionResults<FunctionDescriptor> resolveFunctionCall(@NotNull BasicResolutionContext context) {
|
public OverloadResolutionResults<FunctionDescriptor> resolveFunctionCall(@NotNull BasicCallResolutionContext context) {
|
||||||
|
|
||||||
ProgressIndicatorProvider.checkCanceled();
|
ProgressIndicatorProvider.checkCanceled();
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ public class CallResolver {
|
|||||||
|
|
||||||
private <D extends CallableDescriptor, F extends D> OverloadResolutionResults<F> doResolveCallOrGetCachedResults(
|
private <D extends CallableDescriptor, F extends D> OverloadResolutionResults<F> doResolveCallOrGetCachedResults(
|
||||||
@NotNull WritableSlice<CallKey, OverloadResolutionResults<F>> resolutionResultsSlice,
|
@NotNull WritableSlice<CallKey, OverloadResolutionResults<F>> resolutionResultsSlice,
|
||||||
@NotNull final BasicResolutionContext context,
|
@NotNull final BasicCallResolutionContext context,
|
||||||
@NotNull final List<ResolutionTask<D, F>> prioritizedTasks,
|
@NotNull final List<ResolutionTask<D, F>> prioritizedTasks,
|
||||||
@NotNull CallTransformer<D, F> callTransformer,
|
@NotNull CallTransformer<D, F> callTransformer,
|
||||||
@NotNull final JetReferenceExpression reference) {
|
@NotNull final JetReferenceExpression reference) {
|
||||||
@@ -274,7 +274,7 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (results == null) {
|
if (results == null) {
|
||||||
results = doResolveCall(context.replaceTrace(traceToResolveCall), prioritizedTasks, callTransformer, reference);
|
results = doResolveCall(context.replaceBindingTrace(traceToResolveCall), prioritizedTasks, callTransformer, reference);
|
||||||
if (results instanceof OverloadResolutionResultsImpl) {
|
if (results instanceof OverloadResolutionResultsImpl) {
|
||||||
DelegatingBindingTrace deltasTraceForTypeInference = ((OverloadResolutionResultsImpl) results).getTrace();
|
DelegatingBindingTrace deltasTraceForTypeInference = ((OverloadResolutionResultsImpl) results).getTrace();
|
||||||
if (deltasTraceForTypeInference != null) {
|
if (deltasTraceForTypeInference != null) {
|
||||||
@@ -290,13 +290,13 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
TracingStrategy tracing = prioritizedTasks.iterator().next().tracing;
|
TracingStrategy tracing = prioritizedTasks.iterator().next().tracing;
|
||||||
OverloadResolutionResults<F> completeResults = completeTypeInferenceDependentOnExpectedType(
|
OverloadResolutionResults<F> completeResults = completeTypeInferenceDependentOnExpectedType(
|
||||||
context.replaceTrace(traceToResolveCall), results, tracing);
|
context.replaceBindingTrace(traceToResolveCall), results, tracing);
|
||||||
traceToResolveCall.commit();
|
traceToResolveCall.commit();
|
||||||
return completeResults;
|
return completeResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <D extends CallableDescriptor> OverloadResolutionResults<D> completeTypeInferenceDependentOnExpectedType(
|
private <D extends CallableDescriptor> OverloadResolutionResults<D> completeTypeInferenceDependentOnExpectedType(
|
||||||
@NotNull BasicResolutionContext context,
|
@NotNull BasicCallResolutionContext context,
|
||||||
@NotNull OverloadResolutionResults<D> resultsWithIncompleteTypeInference,
|
@NotNull OverloadResolutionResults<D> resultsWithIncompleteTypeInference,
|
||||||
@NotNull TracingStrategy tracing
|
@NotNull TracingStrategy tracing
|
||||||
) {
|
) {
|
||||||
@@ -343,7 +343,7 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <F extends CallableDescriptor> void cacheResults(@NotNull WritableSlice<CallKey, OverloadResolutionResults<F>> resolutionResultsSlice,
|
private <F extends CallableDescriptor> void cacheResults(@NotNull WritableSlice<CallKey, OverloadResolutionResults<F>> resolutionResultsSlice,
|
||||||
@NotNull BasicResolutionContext context, @NotNull OverloadResolutionResults<F> results,
|
@NotNull BasicCallResolutionContext context, @NotNull OverloadResolutionResults<F> results,
|
||||||
@NotNull DelegatingBindingTrace traceToResolveCall) {
|
@NotNull DelegatingBindingTrace traceToResolveCall) {
|
||||||
//boolean canBeCached = true;
|
//boolean canBeCached = true;
|
||||||
//for (ResolvedCall<? extends CallableDescriptor> call : results.getResultingCalls()) {
|
//for (ResolvedCall<? extends CallableDescriptor> call : results.getResultingCalls()) {
|
||||||
@@ -364,14 +364,14 @@ public class CallResolver {
|
|||||||
context.trace.record(TRACE_DELTAS_CACHE, (JetExpression) callElement, deltasTraceToCacheResolve);
|
context.trace.record(TRACE_DELTAS_CACHE, (JetExpression) callElement, deltasTraceToCacheResolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <D extends CallableDescriptor> OverloadResolutionResults<D> checkArgumentTypesAndFail(BasicResolutionContext context) {
|
private <D extends CallableDescriptor> OverloadResolutionResults<D> checkArgumentTypesAndFail(BasicCallResolutionContext context) {
|
||||||
argumentTypeResolver.checkTypesWithNoCallee(context);
|
argumentTypeResolver.checkTypesWithNoCallee(context);
|
||||||
return OverloadResolutionResultsImpl.nameNotFound();
|
return OverloadResolutionResultsImpl.nameNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private <D extends CallableDescriptor, F extends D> OverloadResolutionResults<F> doResolveCall(
|
private <D extends CallableDescriptor, F extends D> OverloadResolutionResults<F> doResolveCall(
|
||||||
@NotNull final BasicResolutionContext context,
|
@NotNull final BasicCallResolutionContext context,
|
||||||
@NotNull final List<ResolutionTask<D, F>> prioritizedTasks, // high to low priority
|
@NotNull final List<ResolutionTask<D, F>> prioritizedTasks, // high to low priority
|
||||||
@NotNull CallTransformer<D, F> callTransformer,
|
@NotNull CallTransformer<D, F> callTransformer,
|
||||||
@NotNull final JetReferenceExpression reference) {
|
@NotNull final JetReferenceExpression reference) {
|
||||||
@@ -390,7 +390,8 @@ public class CallResolver {
|
|||||||
OverloadResolutionResultsImpl<F> resultsForFirstNonemptyCandidateSet = null;
|
OverloadResolutionResultsImpl<F> resultsForFirstNonemptyCandidateSet = null;
|
||||||
for (ResolutionTask<D, F> task : prioritizedTasks) {
|
for (ResolutionTask<D, F> task : prioritizedTasks) {
|
||||||
TemporaryBindingTrace taskTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve a task for", task.reference);
|
TemporaryBindingTrace taskTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve a task for", task.reference);
|
||||||
OverloadResolutionResultsImpl<F> results = performResolutionGuardedForExtraFunctionLiteralArguments(task.replaceBindingTrace(taskTrace),
|
OverloadResolutionResultsImpl<F> results = performResolutionGuardedForExtraFunctionLiteralArguments(task.replaceBindingTrace(
|
||||||
|
taskTrace),
|
||||||
callTransformer, context.trace);
|
callTransformer, context.trace);
|
||||||
if (results.isSuccess() || results.isAmbiguity()) {
|
if (results.isSuccess() || results.isAmbiguity()) {
|
||||||
taskTrace.commit();
|
taskTrace.commit();
|
||||||
@@ -427,7 +428,7 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <D extends CallableDescriptor> OverloadResolutionResults<D> resolveFunctionArguments(
|
private <D extends CallableDescriptor> OverloadResolutionResults<D> resolveFunctionArguments(
|
||||||
@NotNull final BasicResolutionContext context,
|
@NotNull final BasicCallResolutionContext context,
|
||||||
@NotNull OverloadResolutionResults<D> results
|
@NotNull OverloadResolutionResults<D> results
|
||||||
) {
|
) {
|
||||||
if (results.isSingleResult()) {
|
if (results.isSingleResult()) {
|
||||||
|
|||||||
@@ -190,11 +190,11 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
|||||||
Call functionCall = createFunctionCall(context, task, returnType);
|
Call functionCall = createFunctionCall(context, task, returnType);
|
||||||
|
|
||||||
final DelegatingBindingTrace variableCallTrace = context.candidateCall.getTrace();
|
final DelegatingBindingTrace variableCallTrace = context.candidateCall.getTrace();
|
||||||
BasicResolutionContext basicResolutionContext = BasicResolutionContext.create(
|
BasicCallResolutionContext basicCallResolutionContext = BasicCallResolutionContext.create(
|
||||||
variableCallTrace, context.scope, functionCall, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
variableCallTrace, context.scope, functionCall, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
||||||
|
|
||||||
// 'invoke' call resolve
|
// 'invoke' call resolve
|
||||||
OverloadResolutionResults<FunctionDescriptor> results = callResolver.resolveCallWithGivenName(basicResolutionContext, task.reference, Name.identifier("invoke"));
|
OverloadResolutionResults<FunctionDescriptor> results = callResolver.resolveCallWithGivenName(basicCallResolutionContext, task.reference, Name.identifier("invoke"));
|
||||||
Collection<ResolvedCallWithTrace<FunctionDescriptor>> calls = ((OverloadResolutionResultsImpl<FunctionDescriptor>)results).getResultingCalls();
|
Collection<ResolvedCallWithTrace<FunctionDescriptor>> calls = ((OverloadResolutionResultsImpl<FunctionDescriptor>)results).getResultingCalls();
|
||||||
|
|
||||||
return Collections2.transform(calls, new Function<ResolvedCallWithTrace<FunctionDescriptor>, ResolvedCallWithTrace<FunctionDescriptor>>() {
|
return Collections2.transform(calls, new Function<ResolvedCallWithTrace<FunctionDescriptor>, ResolvedCallWithTrace<FunctionDescriptor>>() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
* Copyright 2010-2013 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use self() file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
@@ -88,7 +88,7 @@ public abstract class ResolutionContext<Context extends ResolutionContext> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public BasicResolutionContext toCallResolutionContext(@NotNull Call call) {
|
public BasicCallResolutionContext toCallResolutionContext(@NotNull Call call) {
|
||||||
return BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
return BasicCallResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.BasicResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.BasicCallResolutionContext;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.CallResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.CallResolutionContext;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem;
|
import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem;
|
||||||
@@ -66,7 +66,7 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends C
|
|||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolutionTask(@NotNull Collection<ResolutionCandidate<D>> candidates, @NotNull JetReferenceExpression reference, @NotNull BasicResolutionContext context) {
|
public ResolutionTask(@NotNull Collection<ResolutionCandidate<D>> candidates, @NotNull JetReferenceExpression reference, @NotNull BasicCallResolutionContext context) {
|
||||||
this(candidates, reference, context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
this(candidates, reference, context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.namespacesAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -25,14 +25,14 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.BasicResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.BasicCallResolutionContext;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
||||||
private final JetReferenceExpression reference;
|
private final JetReferenceExpression reference;
|
||||||
private final BasicResolutionContext basicResolutionContext;
|
private final BasicCallResolutionContext basicCallResolutionContext;
|
||||||
private final Predicate<ResolutionCandidate<D>> visibleStrategy;
|
private final Predicate<ResolutionCandidate<D>> visibleStrategy;
|
||||||
private final boolean isSafeCall;
|
private final boolean isSafeCall;
|
||||||
|
|
||||||
@@ -43,12 +43,12 @@ public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
|||||||
private List<ResolutionTask<D, F>> tasks = null;
|
private List<ResolutionTask<D, F>> tasks = null;
|
||||||
|
|
||||||
public ResolutionTaskHolder(@NotNull JetReferenceExpression reference,
|
public ResolutionTaskHolder(@NotNull JetReferenceExpression reference,
|
||||||
@NotNull BasicResolutionContext basicResolutionContext,
|
@NotNull BasicCallResolutionContext basicCallResolutionContext,
|
||||||
@NotNull Predicate<ResolutionCandidate<D>> visibleStrategy) {
|
@NotNull Predicate<ResolutionCandidate<D>> visibleStrategy) {
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
this.basicResolutionContext = basicResolutionContext;
|
this.basicCallResolutionContext = basicCallResolutionContext;
|
||||||
this.visibleStrategy = visibleStrategy;
|
this.visibleStrategy = visibleStrategy;
|
||||||
this.isSafeCall = JetPsiUtil.isSafeCall(basicResolutionContext.call);
|
this.isSafeCall = JetPsiUtil.isSafeCall(basicCallResolutionContext.call);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ResolutionCandidate<D>> setIsSafeCall(@NotNull Collection<ResolutionCandidate<D>> candidates) {
|
public Collection<ResolutionCandidate<D>> setIsSafeCall(@NotNull Collection<ResolutionCandidate<D>> candidates) {
|
||||||
@@ -83,7 +83,7 @@ public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
|||||||
// If the call is of the form super.foo(), it can actually be only a member
|
// If the call is of the form super.foo(), it can actually be only a member
|
||||||
// But if there's no appropriate member, we would like to report that super cannot be a receiver for an extension
|
// But if there's no appropriate member, we would like to report that super cannot be a receiver for an extension
|
||||||
// Thus, put members first
|
// Thus, put members first
|
||||||
if (TaskPrioritizer.getReceiverSuper(basicResolutionContext.call.getExplicitReceiver()) != null) {
|
if (TaskPrioritizer.getReceiverSuper(basicCallResolutionContext.call.getExplicitReceiver()) != null) {
|
||||||
candidateList.addAll(members);
|
candidateList.addAll(members);
|
||||||
candidateList.addAll(localExtensions);
|
candidateList.addAll(localExtensions);
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
|||||||
for (Collection<ResolutionCandidate<D>> candidates : candidateList) {
|
for (Collection<ResolutionCandidate<D>> candidates : candidateList) {
|
||||||
Collection<ResolutionCandidate<D>> filteredCandidates = Collections2.filter(candidates, visibilityStrategy);
|
Collection<ResolutionCandidate<D>> filteredCandidates = Collections2.filter(candidates, visibilityStrategy);
|
||||||
if (!filteredCandidates.isEmpty()) {
|
if (!filteredCandidates.isEmpty()) {
|
||||||
tasks.add(new ResolutionTask<D, F>(filteredCandidates, reference, basicResolutionContext));
|
tasks.add(new ResolutionTask<D, F>(filteredCandidates, reference, basicCallResolutionContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lang.psi.JetExpression;
|
|||||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||||
import org.jetbrains.jet.lang.psi.JetSuperExpression;
|
import org.jetbrains.jet.lang.psi.JetSuperExpression;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.BasicResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.BasicCallResolutionContext;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.AutoCastServiceImpl;
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.AutoCastServiceImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
@@ -75,7 +75,7 @@ public abstract class TaskPrioritizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static <D extends CallableDescriptor, F extends D> List<ResolutionTask<D, F>> computePrioritizedTasks(@NotNull BasicResolutionContext context, @NotNull Name name,
|
public static <D extends CallableDescriptor, F extends D> List<ResolutionTask<D, F>> computePrioritizedTasks(@NotNull BasicCallResolutionContext context, @NotNull Name name,
|
||||||
@NotNull JetReferenceExpression functionReference, @NotNull List<CallableDescriptorCollector<? extends D>> callableDescriptorCollectors) {
|
@NotNull JetReferenceExpression functionReference, @NotNull List<CallableDescriptorCollector<? extends D>> callableDescriptorCollectors) {
|
||||||
ReceiverValue explicitReceiver = context.call.getExplicitReceiver();
|
ReceiverValue explicitReceiver = context.call.getExplicitReceiver();
|
||||||
final JetScope scope;
|
final JetScope scope;
|
||||||
@@ -106,7 +106,7 @@ public abstract class TaskPrioritizer {
|
|||||||
|
|
||||||
private static <D extends CallableDescriptor, F extends D> void doComputeTasks(@NotNull JetScope scope, @NotNull ReceiverValue receiver,
|
private static <D extends CallableDescriptor, F extends D> void doComputeTasks(@NotNull JetScope scope, @NotNull ReceiverValue receiver,
|
||||||
@NotNull Name name, @NotNull ResolutionTaskHolder<D, F> result,
|
@NotNull Name name, @NotNull ResolutionTaskHolder<D, F> result,
|
||||||
@NotNull BasicResolutionContext context, @NotNull CallableDescriptorCollector<? extends D> callableDescriptorCollector) {
|
@NotNull BasicCallResolutionContext context, @NotNull CallableDescriptorCollector<? extends D> callableDescriptorCollector) {
|
||||||
|
|
||||||
ProgressIndicatorProvider.checkCanceled();
|
ProgressIndicatorProvider.checkCanceled();
|
||||||
|
|
||||||
|
|||||||
+3
-8
@@ -22,11 +22,10 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.Call;
|
import org.jetbrains.jet.lang.psi.Call;
|
||||||
import org.jetbrains.jet.lang.psi.JetQualifiedExpression;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.BasicResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.BasicCallResolutionContext;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.ResolutionContext;
|
import org.jetbrains.jet.lang.resolve.calls.ResolutionContext;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.util.CallMaker;
|
import org.jetbrains.jet.lang.resolve.calls.util.CallMaker;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
||||||
@@ -36,10 +35,6 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.JetTypeInfo;
|
|
||||||
import org.jetbrains.jet.lang.types.TypeUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingContext> {
|
public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingContext> {
|
||||||
|
|
||||||
@@ -113,8 +108,8 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
|
|||||||
|
|
||||||
////////// Call resolution utilities
|
////////// Call resolution utilities
|
||||||
|
|
||||||
private BasicResolutionContext makeResolutionContext(@NotNull Call call) {
|
private BasicCallResolutionContext makeResolutionContext(@NotNull Call call) {
|
||||||
return BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
return BasicCallResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user