Use EXPRESSION_DATA_FLOW_INFO instead of NON_DEFAULT_EXPRESSION_DATA_FLOW

This commit is contained in:
Svetlana Isakova
2014-08-23 12:08:55 +04:00
parent 4e8f10b8ab
commit 7f9ecc50c2
5 changed files with 8 additions and 15 deletions
@@ -130,11 +130,6 @@ public interface BindingContext {
WritableSlice<ScriptDescriptor, JetScope> SCRIPT_SCOPE = Slices.createSimpleSlice();
/**
* Collected during analyze, used in IDE in auto-cast completion
*/
WritableSlice<JetExpression, DataFlowInfo> NON_DEFAULT_EXPRESSION_DATA_FLOW = Slices.createSimpleSlice();
WritableSlice<JetExpression, Boolean> VARIABLE_REASSIGNMENT = Slices.createSimpleSetSlice();
WritableSlice<ValueParameterDescriptor, Boolean> AUTO_CREATED_IT = Slices.createSimpleSetSlice();
@@ -20,13 +20,10 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.psi.PsiElement;
import kotlin.Function1;
import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.jet.lang.resolve.*;
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
import org.jetbrains.jet.lang.resolve.calls.callUtil.CallUtilPackage;
@@ -56,7 +53,7 @@ import java.util.List;
import static org.jetbrains.jet.lang.diagnostics.Errors.NOT_A_CLASS;
import static org.jetbrains.jet.lang.diagnostics.Errors.NO_CONSTRUCTOR;
import static org.jetbrains.jet.lang.resolve.BindingContext.NON_DEFAULT_EXPRESSION_DATA_FLOW;
import static org.jetbrains.jet.lang.resolve.BindingContext.EXPRESSION_DATA_FLOW_INFO;
import static org.jetbrains.jet.lang.resolve.BindingContext.RESOLUTION_SCOPE;
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
@@ -417,8 +414,8 @@ public class CallResolver {
) {
context.trace.record(RESOLUTION_SCOPE, context.call.getCalleeExpression(), context.scope);
if (context.dataFlowInfo.hasTypeInfoConstraints()) {
context.trace.record(NON_DEFAULT_EXPRESSION_DATA_FLOW, context.call.getCalleeExpression(), context.dataFlowInfo);
if (context.dataFlowInfo != DataFlowInfo.EMPTY) {
context.trace.record(EXPRESSION_DATA_FLOW_INFO, context.call.getCalleeExpression(), context.dataFlowInfo);
}
return doResolveCall(context, prioritizedTasks, callTransformer, tracing);
@@ -39,6 +39,7 @@ import org.jetbrains.jet.lang.types.expressions.ExpressionTypingContext
import org.jetbrains.jet.lang.psi.psiUtil.getTopmostParentQualifiedExpressionForSelector
import org.jetbrains.jet.lang.resolve.descriptorUtil.getClassObjectReferenceTarget
import org.jetbrains.jet.lang.psi.JetExpression
import org.jetbrains.jet.lang.resolve.bindingContextUtil.recordScopeAndDataFlowInfo
import kotlin.properties.Delegates
public trait Qualifier {
@@ -122,8 +123,8 @@ fun createQualifier(
if (packageViewDescriptor == null && classifierDescriptor == null) return null
context.trace.record(RESOLUTION_SCOPE, expression, context.scope)
if (context.dataFlowInfo.hasTypeInfoConstraints()) {
context.trace.record(NON_DEFAULT_EXPRESSION_DATA_FLOW, expression, context.dataFlowInfo)
if (context.dataFlowInfo != DataFlowInfo.EMPTY) {
context.trace.record(EXPRESSION_DATA_FLOW_INFO, expression, context.dataFlowInfo)
}
val qualifier = QualifierReceiver(expression, packageViewDescriptor, classifierDescriptor)
@@ -66,7 +66,7 @@ public final class TipsManager {
if (expressionType != null && resolutionScope != null && !expressionType.isError()) {
ExpressionReceiver receiverValue = new ExpressionReceiver(receiverExpression, expressionType);
DataFlowInfo info = context.get(BindingContext.NON_DEFAULT_EXPRESSION_DATA_FLOW, expression);
DataFlowInfo info = context.get(BindingContext.EXPRESSION_DATA_FLOW_INFO, expression);
if (info == null) {
info = DataFlowInfo.EMPTY;
}
@@ -124,7 +124,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression); //can be null or error type
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, expression);
if (scope != null) {
DataFlowInfo dataFlowInfo = bindingContext.get(BindingContext.NON_DEFAULT_EXPRESSION_DATA_FLOW, expression);
DataFlowInfo dataFlowInfo = bindingContext.get(BindingContext.EXPRESSION_DATA_FLOW_INFO, expression);
if (dataFlowInfo == null) {
dataFlowInfo = DataFlowInfo.EMPTY;
}