rename ResolutionContext to CallResolutionContext

introduced ResolutionContext (without call)
This commit is contained in:
Svetlana Isakova
2013-01-25 17:35:35 +04:00
parent 87a6be6749
commit 2d9f147dbc
8 changed files with 63 additions and 21 deletions
@@ -82,11 +82,11 @@ public class ArgumentTypeResolver {
return KotlinBuiltIns.getInstance().isFunctionOrExtensionFunctionType(supertype) || ErrorUtils.isErrorType(supertype);
}
public void checkTypesWithNoCallee(@NotNull ResolutionContext context) {
public void checkTypesWithNoCallee(@NotNull CallResolutionContext context) {
checkTypesWithNoCallee(context, SKIP_FUNCTION_ARGUMENTS);
}
public void checkTypesWithNoCallee(@NotNull ResolutionContext context, @NotNull ResolveMode resolveFunctionArgumentBodies) {
public void checkTypesWithNoCallee(@NotNull CallResolutionContext context, @NotNull ResolveMode resolveFunctionArgumentBodies) {
for (ValueArgument valueArgument : context.call.getValueArguments()) {
JetExpression argumentExpression = valueArgument.getArgumentExpression();
if (argumentExpression != null && !(argumentExpression instanceof JetFunctionLiteralExpression)) {
@@ -109,7 +109,7 @@ public class ArgumentTypeResolver {
}
}
public void checkTypesForFunctionArgumentsWithNoCallee(@NotNull ResolutionContext context) {
public void checkTypesForFunctionArgumentsWithNoCallee(@NotNull CallResolutionContext context) {
for (ValueArgument valueArgument : context.call.getValueArguments()) {
JetExpression argumentExpression = valueArgument.getArgumentExpression();
if (argumentExpression != null && (argumentExpression instanceof JetFunctionLiteralExpression)) {
@@ -122,7 +122,7 @@ public class ArgumentTypeResolver {
}
}
public void checkUnmappedArgumentTypes(ResolutionContext context, Set<ValueArgument> unmappedArguments) {
public void checkUnmappedArgumentTypes(CallResolutionContext context, Set<ValueArgument> unmappedArguments) {
for (ValueArgument valueArgument : unmappedArguments) {
JetExpression argumentExpression = valueArgument.getArgumentExpression();
if (argumentExpression != null) {
@@ -131,7 +131,7 @@ public class ArgumentTypeResolver {
}
}
public <D extends CallableDescriptor> void checkTypesForFunctionArguments(ResolutionContext context, ResolvedCallImpl<D> resolvedCall) {
public <D extends CallableDescriptor> void checkTypesForFunctionArguments(CallResolutionContext context, ResolvedCallImpl<D> resolvedCall) {
Map<ValueParameterDescriptor, ResolvedValueArgument> arguments = resolvedCall.getValueArguments();
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : arguments.entrySet()) {
ValueParameterDescriptor valueParameterDescriptor = entry.getKey();
@@ -23,7 +23,7 @@ import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.JetType;
public class BasicResolutionContext extends ResolutionContext {
public class BasicResolutionContext extends CallResolutionContext {
@NotNull
public static BasicResolutionContext create(
@NotNull BindingTrace trace,
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionTask;
import org.jetbrains.jet.lang.resolve.calls.tasks.TracingStrategy;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
public final class CallCandidateResolutionContext<D extends CallableDescriptor, F extends D> extends ResolutionContext {
public final class CallCandidateResolutionContext<D extends CallableDescriptor, F extends D> extends CallResolutionContext {
/*package*/ final ResolvedCallImpl<D> candidateCall;
/*package*/ final TracingStrategy tracing;
/*package*/ ReceiverValue receiverForVariableAsFunctionSecondCall = ReceiverValue.NO_RECEIVER;
@@ -0,0 +1,43 @@
/*
* Copyright 2010-2012 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.lang.resolve.calls;
import org.jetbrains.jet.lang.psi.Call;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.JetType;
public abstract class CallResolutionContext extends ResolutionContext {
public final Call call;
protected CallResolutionContext(
BindingTrace trace,
JetScope scope,
Call call,
JetType expectedType,
DataFlowInfo dataFlowInfo,
boolean namespacesAllowed
) {
super(trace, scope, expectedType, dataFlowInfo, namespacesAllowed);
this.call = call;
}
public BasicResolutionContext toBasic() {
return BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
}
}
@@ -44,7 +44,7 @@ public class CallResolverUtil {
private CallResolverUtil() {}
public static <D extends CallableDescriptor> ResolvedCallImpl<D> copy(@NotNull ResolvedCallImpl<D> call, @NotNull ResolutionContext context) {
public static <D extends CallableDescriptor> ResolvedCallImpl<D> copy(@NotNull ResolvedCallImpl<D> call, @NotNull CallResolutionContext context) {
ResolutionCandidate<D> candidate = ResolutionCandidate.create(call.getCandidateDescriptor(), call.getThisObject(),
call.getReceiverArgument(), call.getExplicitReceiverKind(),
call.isSafeCall());
@@ -352,7 +352,7 @@ public class CandidateResolver {
@NotNull ValueParameterDescriptor valueParameterDescriptor,
@NotNull TypeSubstitutor substitutor,
@NotNull ConstraintSystem constraintSystem,
@NotNull ResolutionContext context,
@NotNull CallResolutionContext context,
@Nullable boolean[] isErrorType,
@NotNull ResolveMode resolveFunctionArgumentBodies) {
@@ -395,7 +395,7 @@ public class CandidateResolver {
}
private <D extends CallableDescriptor> ValueArgumentsCheckingResult checkValueArgumentTypes(
@NotNull ResolutionContext context,
@NotNull CallResolutionContext context,
@NotNull ResolvedCallImpl<D> candidateCall,
@NotNull BindingTrace trace,
@NotNull ResolveMode resolveFunctionArgumentBodies) {
@@ -16,30 +16,29 @@
package org.jetbrains.jet.lang.resolve.calls;
import org.jetbrains.jet.lang.psi.Call;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.JetType;
public abstract class ResolutionContext {
public class ResolutionContext {
public final BindingTrace trace;
public final JetScope scope;
public final Call call;
public final JetType expectedType;
public final DataFlowInfo dataFlowInfo;
public final boolean namespacesAllowed;
protected ResolutionContext(BindingTrace trace, JetScope scope, Call call, JetType expectedType, DataFlowInfo dataFlowInfo, boolean namespacesAllowed) {
protected ResolutionContext(
BindingTrace trace,
JetScope scope,
JetType expectedType,
DataFlowInfo dataFlowInfo,
boolean namespacesAllowed
) {
this.trace = trace;
this.scope = scope;
this.call = call;
this.expectedType = expectedType;
this.dataFlowInfo = dataFlowInfo;
this.namespacesAllowed = namespacesAllowed;
}
public BasicResolutionContext toBasic() {
return BasicResolutionContext.create(trace, scope, call, expectedType, dataFlowInfo, namespacesAllowed);
}
}
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lang.diagnostics.Errors;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.calls.BasicResolutionContext;
import org.jetbrains.jet.lang.resolve.calls.ResolutionContext;
import org.jetbrains.jet.lang.resolve.calls.CallResolutionContext;
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.InferenceErrorData;
@@ -52,7 +52,7 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.*;
/**
* Stores candidates for call resolution.
*/
public class ResolutionTask<D extends CallableDescriptor, F extends D> extends ResolutionContext {
public class ResolutionTask<D extends CallableDescriptor, F extends D> extends CallResolutionContext {
private final Collection<ResolutionCandidate<D>> candidates;
private final Set<ResolvedCallWithTrace<F>> resolvedCalls = Sets.newLinkedHashSet();
public final JetReferenceExpression reference;