From 2d9f147dbcca4638ba09efad1de63fe36b84a315 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Fri, 25 Jan 2013 17:35:35 +0400 Subject: [PATCH] rename ResolutionContext to CallResolutionContext introduced ResolutionContext (without call) --- .../resolve/calls/ArgumentTypeResolver.java | 10 ++--- .../resolve/calls/BasicResolutionContext.java | 2 +- .../calls/CallCandidateResolutionContext.java | 2 +- .../resolve/calls/CallResolutionContext.java | 43 +++++++++++++++++++ .../lang/resolve/calls/CallResolverUtil.java | 2 +- .../lang/resolve/calls/CandidateResolver.java | 4 +- .../lang/resolve/calls/ResolutionContext.java | 17 ++++---- .../resolve/calls/tasks/ResolutionTask.java | 4 +- 8 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java index 7ac5755d86e..37e3b2e7146 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java @@ -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 unmappedArguments) { + public void checkUnmappedArgumentTypes(CallResolutionContext context, Set unmappedArguments) { for (ValueArgument valueArgument : unmappedArguments) { JetExpression argumentExpression = valueArgument.getArgumentExpression(); if (argumentExpression != null) { @@ -131,7 +131,7 @@ public class ArgumentTypeResolver { } } - public void checkTypesForFunctionArguments(ResolutionContext context, ResolvedCallImpl resolvedCall) { + public void checkTypesForFunctionArguments(CallResolutionContext context, ResolvedCallImpl resolvedCall) { Map arguments = resolvedCall.getValueArguments(); for (Map.Entry entry : arguments.entrySet()) { ValueParameterDescriptor valueParameterDescriptor = entry.getKey(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/BasicResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/BasicResolutionContext.java index 371c1150b02..4be01f545f8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/BasicResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/BasicResolutionContext.java @@ -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, diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java index 5c60556059f..bf41ab9710b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java @@ -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 extends ResolutionContext { +public final class CallCandidateResolutionContext extends CallResolutionContext { /*package*/ final ResolvedCallImpl candidateCall; /*package*/ final TracingStrategy tracing; /*package*/ ReceiverValue receiverForVariableAsFunctionSecondCall = ReceiverValue.NO_RECEIVER; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java new file mode 100644 index 00000000000..10feb8e5da2 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java @@ -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); + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolverUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolverUtil.java index 72bb1bfeed6..87bde34726d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolverUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolverUtil.java @@ -44,7 +44,7 @@ public class CallResolverUtil { private CallResolverUtil() {} - public static ResolvedCallImpl copy(@NotNull ResolvedCallImpl call, @NotNull ResolutionContext context) { + public static ResolvedCallImpl copy(@NotNull ResolvedCallImpl call, @NotNull CallResolutionContext context) { ResolutionCandidate candidate = ResolutionCandidate.create(call.getCandidateDescriptor(), call.getThisObject(), call.getReceiverArgument(), call.getExplicitReceiverKind(), call.isSafeCall()); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index d3d9c9505b8..1cf517981a4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -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 ValueArgumentsCheckingResult checkValueArgumentTypes( - @NotNull ResolutionContext context, + @NotNull CallResolutionContext context, @NotNull ResolvedCallImpl candidateCall, @NotNull BindingTrace trace, @NotNull ResolveMode resolveFunctionArgumentBodies) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionContext.java index 47d32289f1d..e064aa54ede 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionContext.java @@ -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); - } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/tasks/ResolutionTask.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/tasks/ResolutionTask.java index 4a1a6758057..37cc5fd33a8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/tasks/ResolutionTask.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/tasks/ResolutionTask.java @@ -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 extends ResolutionContext { +public class ResolutionTask extends CallResolutionContext { private final Collection> candidates; private final Set> resolvedCalls = Sets.newLinkedHashSet(); public final JetReferenceExpression reference;