001    /*
002     * Copyright 2010-2015 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    
017    package org.jetbrains.kotlin.resolve.calls.model;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.jetbrains.annotations.Nullable;
021    import org.jetbrains.kotlin.descriptors.CallableDescriptor;
022    import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
023    import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
024    import org.jetbrains.kotlin.psi.Call;
025    import org.jetbrains.kotlin.psi.ValueArgument;
026    import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus;
027    import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
028    import org.jetbrains.kotlin.resolve.scopes.receivers.Receiver;
029    import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
030    import org.jetbrains.kotlin.types.KotlinType;
031    
032    import java.util.List;
033    import java.util.Map;
034    
035    public interface ResolvedCall<D extends CallableDescriptor> {
036        @NotNull
037        ResolutionStatus getStatus();
038    
039        /** The call that was resolved to this ResolvedCall */
040        @NotNull
041        Call getCall();
042    
043        /** A target callable descriptor as it was accessible in the corresponding scope, i.e. with type arguments not substituted */
044        @NotNull
045        D getCandidateDescriptor();
046    
047        /** Type arguments are substituted. This descriptor is guaranteed to have NO declared type parameters */
048        @NotNull
049        D getResultingDescriptor();
050    
051        /** If the target was an extension function or property, this is the value for its receiver parameter */
052        @NotNull
053        Receiver getExtensionReceiver();
054    
055        /** If the target was a member of a class, this is the object of that class to call it on */
056        @NotNull
057        ReceiverValue getDispatchReceiver();
058    
059        /** Determines whether receiver argument or this object is substituted for explicit receiver */
060        @NotNull
061        ExplicitReceiverKind getExplicitReceiverKind();
062    
063        /** Values (arguments) for value parameters */
064        @NotNull
065        Map<ValueParameterDescriptor, ResolvedValueArgument> getValueArguments();
066    
067        /** Values (arguments) for value parameters indexed by parameter index */
068        @Nullable
069        List<ResolvedValueArgument> getValueArgumentsByIndex();
070    
071        /** The result of mapping the value argument to a parameter */
072        @NotNull
073        ArgumentMapping getArgumentMapping(@NotNull ValueArgument valueArgument);
074    
075        /** What's substituted for type parameters */
076        @NotNull
077        Map<TypeParameterDescriptor, KotlinType> getTypeArguments();
078    
079        /** Data flow info for each argument and the result data flow info */
080        @NotNull
081        DataFlowInfoForArguments getDataFlowInfoForArguments();
082    
083        boolean isSafeCall();
084    }