Record resolved call on call (not on element)
This commit is contained in:
@@ -87,8 +87,8 @@ public interface BindingContext {
|
||||
WritableSlice<JetReferenceExpression, DeclarationDescriptor> REFERENCE_TARGET =
|
||||
new BasicWritableSlice<JetReferenceExpression, DeclarationDescriptor>(DO_NOTHING);
|
||||
|
||||
@KotlinSignature("val RESOLVED_CALL: WritableSlice<JetElement, ResolvedCall<out CallableDescriptor>>")
|
||||
WritableSlice<JetElement, ResolvedCall<?>> RESOLVED_CALL = new BasicWritableSlice<JetElement, ResolvedCall<?>>(DO_NOTHING);
|
||||
@KotlinSignature("val RESOLVED_CALL: WritableSlice<Call, ResolvedCall<out CallableDescriptor>>")
|
||||
WritableSlice<Call, ResolvedCall<?>> RESOLVED_CALL = new BasicWritableSlice<Call, ResolvedCall<?>>(DO_NOTHING);
|
||||
WritableSlice<ResolvedCall<?>, TailRecursionKind> TAIL_RECURSION_CALL = Slices.createSimpleSlice();
|
||||
WritableSlice<JetElement, ConstraintSystemCompleter> CONSTRAINT_SYSTEM_COMPLETER = new BasicWritableSlice<JetElement, ConstraintSystemCompleter>(DO_NOTHING);
|
||||
WritableSlice<JetElement, Call> CALL = new BasicWritableSlice<JetElement, Call>(DO_NOTHING);
|
||||
|
||||
@@ -80,13 +80,7 @@ public fun JetExpression.getParentCall(context: BindingContext): Call? {
|
||||
}
|
||||
|
||||
public fun Call?.getResolvedCall(context: BindingContext): ResolvedCall<out CallableDescriptor>? {
|
||||
if (this == null) return null
|
||||
if (this is CallForImplicitInvoke) {
|
||||
// callee for invoke is implicit (doesn't exist), so the key is callee of outer call (which is 'this object' for 'invoke' call)
|
||||
return context[RESOLVED_CALL, this.getThisObject().getExpression()]
|
||||
}
|
||||
|
||||
return context[RESOLVED_CALL, this.getCalleeExpression()]
|
||||
return context[RESOLVED_CALL, this]
|
||||
}
|
||||
|
||||
public fun JetElement?.getResolvedCall(context: BindingContext): ResolvedCall<out CallableDescriptor>? {
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class TracingStrategyForInvoke extends AbstractTracingStrategy {
|
||||
@NotNull BindingTrace trace, @NotNull ResolvedCall<D> resolvedCall
|
||||
) {
|
||||
if (reference instanceof JetSimpleNameExpression) return;
|
||||
trace.record(RESOLVED_CALL, reference, resolvedCall);
|
||||
trace.record(RESOLVED_CALL, call, resolvedCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class TracingStrategyImpl extends AbstractTracingStrategy {
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void bindResolvedCall(@NotNull BindingTrace trace, @NotNull ResolvedCall<D> resolvedCall) {
|
||||
trace.record(RESOLVED_CALL, call.getCalleeExpression(), resolvedCall);
|
||||
trace.record(RESOLVED_CALL, call, resolvedCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -425,7 +425,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
new DataFlowInfoForArgumentsImpl(call));
|
||||
resolvedCall.markCallAsCompleted();
|
||||
|
||||
trace.record(RESOLVED_CALL, expression, resolvedCall);
|
||||
trace.record(RESOLVED_CALL, call, resolvedCall);
|
||||
trace.record(CALL, expression, call);
|
||||
|
||||
context.callResolverExtension.run(resolvedCall,
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ public class ControlStructureTypingUtils {
|
||||
public <D extends CallableDescriptor> void bindResolvedCall(
|
||||
@NotNull BindingTrace trace, @NotNull ResolvedCall<D> resolvedCall
|
||||
) {
|
||||
trace.record(RESOLVED_CALL, call.getCalleeExpression(), resolvedCall);
|
||||
trace.record(RESOLVED_CALL, call, resolvedCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.jet.cli.jvm.compiler.CliLightClassGenerationSupport;
|
||||
import org.jetbrains.jet.lang.descriptors.DependencyKind;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ModuleDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.diagnostics.*;
|
||||
import org.jetbrains.jet.lang.psi.Call;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
@@ -133,9 +134,9 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
ImmutableMap<JetElement, ResolvedCall<?>> resolvedCallsEntries = bindingContext.getSliceContents(BindingContext.RESOLVED_CALL);
|
||||
for (Map.Entry<JetElement, ResolvedCall<?>> entry : resolvedCallsEntries.entrySet()) {
|
||||
JetElement element = entry.getKey();
|
||||
ImmutableMap<Call, ResolvedCall<?>> resolvedCallsEntries = bindingContext.getSliceContents(BindingContext.RESOLVED_CALL);
|
||||
for (Map.Entry<Call, ResolvedCall<?>> entry : resolvedCallsEntries.entrySet()) {
|
||||
JetElement element = entry.getKey().getCallElement();
|
||||
ResolvedCall<?> resolvedCall = entry.getValue();
|
||||
|
||||
DiagnosticUtils.LineAndColumn lineAndColumn =
|
||||
|
||||
Reference in New Issue
Block a user