use of org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall in project kotlin by JetBrains.
the class TracingStrategyImpl method bindReference.
@Override
public <D extends CallableDescriptor> void bindReference(@NotNull BindingTrace trace, @NotNull ResolvedCall<D> resolvedCall) {
DeclarationDescriptor descriptor = resolvedCall.getCandidateDescriptor();
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
descriptor = ((VariableAsFunctionResolvedCall) resolvedCall).getVariableCall().getCandidateDescriptor();
}
if (descriptor instanceof FakeCallableDescriptorForObject) {
FakeCallableDescriptorForObject fakeCallableDescriptorForObject = (FakeCallableDescriptorForObject) descriptor;
descriptor = fakeCallableDescriptorForObject.getReferencedDescriptor();
if (fakeCallableDescriptorForObject.getClassDescriptor().getCompanionObjectDescriptor() != null) {
trace.record(SHORT_REFERENCE_TO_COMPANION_OBJECT, reference, fakeCallableDescriptorForObject.getClassDescriptor());
}
}
DeclarationDescriptor storedReference = trace.get(REFERENCE_TARGET, reference);
if (storedReference == null || !ErrorUtils.isError(descriptor)) {
trace.record(REFERENCE_TARGET, reference, descriptor);
}
}
use of org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall in project kotlin by JetBrains.
the class KtInvokeFunctionReference method getTargetDescriptors.
@Override
@NotNull
protected Collection<DeclarationDescriptor> getTargetDescriptors(@NotNull BindingContext context) {
Call call = CallUtilKt.getCall(getElement(), context);
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(call, context);
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
return Collections.<DeclarationDescriptor>singleton(((VariableAsFunctionResolvedCall) resolvedCall).getFunctionCall().getCandidateDescriptor());
}
if (call != null && resolvedCall != null && call.getCallType() == Call.CallType.INVOKE) {
return Collections.<DeclarationDescriptor>singleton(resolvedCall.getCandidateDescriptor());
}
return Collections.emptyList();
}
Aggregations