001/*
002 * Copyright 2010-2013 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.jetbrains.jet.lang.resolve.calls.context;
018
019import org.jetbrains.annotations.NotNull;
020import org.jetbrains.jet.lang.psi.Call;
021import org.jetbrains.jet.lang.resolve.BindingTrace;
022import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
023import org.jetbrains.jet.lang.resolve.scopes.JetScope;
024import org.jetbrains.jet.lang.types.JetType;
025
026public class BasicCallResolutionContext extends CallResolutionContext<BasicCallResolutionContext> {
027    @NotNull
028    public static BasicCallResolutionContext create(
029            @NotNull BindingTrace trace,
030            @NotNull JetScope scope,
031            @NotNull Call call,
032            @NotNull JetType expectedType,
033            @NotNull DataFlowInfo dataFlowInfo,
034            @NotNull ResolveMode resolveMode,
035            @NotNull CheckValueArgumentsMode checkArguments,
036            @NotNull ExpressionPosition expressionPosition,
037            @NotNull ResolutionResultsCache resolutionResultsCache
038    ) {
039        return new BasicCallResolutionContext(trace, scope, call, expectedType, dataFlowInfo, resolveMode, checkArguments, expressionPosition, resolutionResultsCache);
040    }
041    @NotNull
042    public static BasicCallResolutionContext create(
043            @NotNull ResolutionContext context, @NotNull Call call, @NotNull ResolveMode resolveMode,
044            @NotNull CheckValueArgumentsMode checkArguments, @NotNull ResolutionResultsCache resolutionResultsCache
045    ) {
046        return create(context.trace, context.scope, call, context.expectedType, context.dataFlowInfo, resolveMode, checkArguments, context.expressionPosition, resolutionResultsCache);
047    }
048
049    private BasicCallResolutionContext(
050            BindingTrace trace, JetScope scope, Call call, JetType expectedType,
051            DataFlowInfo dataFlowInfo, ResolveMode resolveMode, CheckValueArgumentsMode checkArguments,
052            ExpressionPosition expressionPosition, ResolutionResultsCache resolutionResultsCache
053    ) {
054        super(trace, scope, call, expectedType, dataFlowInfo, resolveMode, checkArguments, expressionPosition, resolutionResultsCache);
055    }
056
057    @Override
058    protected BasicCallResolutionContext create(
059            @NotNull BindingTrace trace,
060            @NotNull JetScope scope,
061            @NotNull DataFlowInfo dataFlowInfo,
062            @NotNull JetType expectedType,
063            @NotNull ExpressionPosition expressionPosition
064    ) {
065        return create(trace, scope, call, expectedType, dataFlowInfo, resolveMode, checkArguments, expressionPosition, resolutionResultsCache);
066    }
067
068    @Override
069    protected BasicCallResolutionContext self() {
070        return this;
071    }
072}