Resolve invoke on any kind of expressions, not only on simple name expressions
This commit is contained in:
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.CallResolverUtil;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
@@ -32,6 +33,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.CALL;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.RESOLVED_CALL;
|
||||
|
||||
class JetInvokeFunctionReference extends JetSimpleReference<JetCallExpression> implements MultiRangeReference {
|
||||
@@ -48,10 +50,15 @@ class JetInvokeFunctionReference extends JetSimpleReference<JetCallExpression> i
|
||||
@Override
|
||||
@NotNull
|
||||
protected Collection<DeclarationDescriptor> getTargetDescriptors(@NotNull BindingContext context) {
|
||||
ResolvedCall<?> resolvedCall = context.get(RESOLVED_CALL, getExpression().getCalleeExpression());
|
||||
JetExpression calleeExpression = getExpression().getCalleeExpression();
|
||||
ResolvedCall<?> resolvedCall = context.get(RESOLVED_CALL, calleeExpression);
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return Collections.<DeclarationDescriptor>singleton(((VariableAsFunctionResolvedCall) resolvedCall).getCandidateDescriptor());
|
||||
}
|
||||
Call call = context.get(CALL, calleeExpression);
|
||||
if (call != null && resolvedCall != null && call.getCallType() == Call.CallType.INVOKE) {
|
||||
return Collections.<DeclarationDescriptor>singleton(resolvedCall.getCandidateDescriptor());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user