refactoring: rename, fixes after review
This commit is contained in:
@@ -317,7 +317,7 @@ public class CallResolver {
|
||||
results = completeTypeInferenceDependentOnExpectedType(context, results, tracing);
|
||||
if (results.isSingleResult()) {
|
||||
//todo clean internal data for several resulting calls
|
||||
results.getResultingCall().cleanInternalData();
|
||||
results.getResultingCall().markCallAsCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -370,12 +370,12 @@ public class CandidateResolver {
|
||||
JetType result = BindingContextUtils.updateRecordedType(
|
||||
type, expression, context.trace, isFairSafeCallExpression(expression, context.trace));
|
||||
|
||||
contextForArgument.candidateCall.cleanInternalData();
|
||||
contextForArgument.candidateCall.markCallAsCompleted();
|
||||
|
||||
// clean data for "invoke" calls
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall = context.resolutionResultsCache.getCallForArgument(keyExpression);
|
||||
assert resolvedCall != null : "Resolved call for '" + keyExpression + "' is not stored, but CallCandidateResolutionContext is.";
|
||||
resolvedCall.cleanInternalData();
|
||||
resolvedCall.markCallAsCompleted();
|
||||
|
||||
DataFlowUtils.checkType(result, expression, contextForArgument);
|
||||
}
|
||||
|
||||
+24
-23
@@ -88,7 +88,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
|
||||
private boolean hasUnknownTypeParameters = false;
|
||||
private ConstraintSystem constraintSystem = null;
|
||||
private boolean hasInferredReturnType;
|
||||
private boolean cleaned = false;
|
||||
private boolean completed = false;
|
||||
|
||||
private ResolvedCallImpl(
|
||||
@NotNull ResolutionCandidate<D> candidate,
|
||||
@@ -133,32 +133,13 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
|
||||
@Override
|
||||
@NotNull
|
||||
public DelegatingBindingTrace getTrace() {
|
||||
checkCallIsUnfinished("Trace");
|
||||
assertNotCompleted("Trace");
|
||||
return trace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanInternalData() {
|
||||
if (!cleaned) {
|
||||
hasInferredReturnType = CallResolverUtil.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
||||
}
|
||||
trace = null;
|
||||
constraintSystem = null;
|
||||
tracing = null;
|
||||
cleaned = true;
|
||||
}
|
||||
|
||||
public boolean hasInferredReturnType() {
|
||||
return hasInferredReturnType;
|
||||
}
|
||||
|
||||
private void checkCallIsUnfinished(String elementName) {
|
||||
if (cleaned) throw new IllegalStateException(elementName + " is erased after resolution completion.");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TracingStrategy getTracing() {
|
||||
checkCallIsUnfinished("TracingStrategy");
|
||||
assertNotCompleted("TracingStrategy");
|
||||
return tracing;
|
||||
}
|
||||
|
||||
@@ -205,7 +186,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
|
||||
|
||||
@Nullable
|
||||
public ConstraintSystem getConstraintSystem() {
|
||||
checkCallIsUnfinished("ConstraintSystem");
|
||||
assertNotCompleted("ConstraintSystem");
|
||||
return constraintSystem;
|
||||
}
|
||||
|
||||
@@ -306,4 +287,24 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
|
||||
public ResolvedCallImpl<D> getCallToCompleteTypeArgumentInference() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasInferredReturnType() {
|
||||
if (!completed) throw new IllegalStateException("Inferred return type is not known before resolution completion.");
|
||||
return hasInferredReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markCallAsCompleted() {
|
||||
if (!completed) {
|
||||
hasInferredReturnType = CallResolverUtil.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
||||
}
|
||||
trace = null;
|
||||
constraintSystem = null;
|
||||
tracing = null;
|
||||
completed = true;
|
||||
}
|
||||
|
||||
private void assertNotCompleted(String elementName) {
|
||||
if (completed) throw new IllegalStateException(elementName + " is erased after resolution completion.");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,5 +46,5 @@ public interface ResolvedCallWithTrace<D extends CallableDescriptor> extends Res
|
||||
@NotNull
|
||||
ResolvedCallImpl<D> getCallToCompleteTypeArgumentInference();
|
||||
|
||||
void cleanInternalData();
|
||||
void markCallAsCompleted();
|
||||
}
|
||||
|
||||
+3
-3
@@ -139,8 +139,8 @@ public class VariableAsFunctionResolvedCall implements ResolvedCallWithTrace<Fun
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanInternalData() {
|
||||
functionCall.cleanInternalData();
|
||||
variableCall.cleanInternalData();
|
||||
public void markCallAsCompleted() {
|
||||
functionCall.markCallAsCompleted();
|
||||
variableCall.markCallAsCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user