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