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.model;
018
019import org.jetbrains.annotations.NotNull;
020import org.jetbrains.annotations.Nullable;
021import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
022import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
023import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
024import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
025import org.jetbrains.jet.lang.resolve.calls.tasks.ExplicitReceiverKind;
026import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
027import org.jetbrains.jet.lang.types.JetType;
028
029import java.util.List;
030import java.util.Map;
031
032public interface ResolvedCall<D extends CallableDescriptor> {
033    /** A target callable descriptor as it was accessible in the corresponding scope, i.e. with type arguments not substituted */
034    @NotNull
035    D getCandidateDescriptor();
036
037    /** Type arguments are substituted. This descriptor is guaranteed to have NO declared type parameters */
038    @NotNull
039    D getResultingDescriptor();
040
041    /** If the target was an extension function or property, this is the value for its receiver parameter */
042    @NotNull
043    ReceiverValue getReceiverArgument();
044
045    /** If the target was a member of a class, this is the object of that class to call it on */
046    @NotNull
047    ReceiverValue getThisObject();
048
049    /** Determines whether receiver argument or this object is substituted for explicit receiver */
050    @NotNull
051    ExplicitReceiverKind getExplicitReceiverKind();
052
053    /** Values (arguments) for value parameters */
054    @NotNull
055    Map<ValueParameterDescriptor, ResolvedValueArgument> getValueArguments();
056
057    /** Values (arguments) for value parameters indexed by parameter index */
058    @NotNull
059    List<ResolvedValueArgument> getValueArgumentsByIndex();
060
061    /** What's substituted for type parameters */
062    @NotNull
063    Map<TypeParameterDescriptor, JetType> getTypeArguments();
064
065    @NotNull
066    DataFlowInfo getDataFlowInfo();
067
068    boolean isSafeCall();
069}