From 7f9ecc50c2971e4666271338851199eea2e065b9 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Sat, 23 Aug 2014 12:08:55 +0400 Subject: [PATCH] Use EXPRESSION_DATA_FLOW_INFO instead of NON_DEFAULT_EXPRESSION_DATA_FLOW --- .../org/jetbrains/jet/lang/resolve/BindingContext.java | 5 ----- .../jetbrains/jet/lang/resolve/calls/CallResolver.java | 9 +++------ .../jet/lang/resolve/scopes/receivers/Qualifier.kt | 5 +++-- .../jetbrains/jet/plugin/codeInsight/TipsManager.java | 2 +- .../KotlinIntroduceVariableHandler.java | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContext.java index 9da3185ee9d..32b665e3c4a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContext.java @@ -130,11 +130,6 @@ public interface BindingContext { WritableSlice SCRIPT_SCOPE = Slices.createSimpleSlice(); - /** - * Collected during analyze, used in IDE in auto-cast completion - */ - WritableSlice NON_DEFAULT_EXPRESSION_DATA_FLOW = Slices.createSimpleSlice(); - WritableSlice VARIABLE_REASSIGNMENT = Slices.createSimpleSetSlice(); WritableSlice AUTO_CREATED_IT = Slices.createSimpleSetSlice(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index 01e17ceebe6..5522c09ab23 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -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); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/receivers/Qualifier.kt b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/receivers/Qualifier.kt index d018e26df30..97bc1328b0f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/receivers/Qualifier.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/receivers/Qualifier.kt @@ -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) diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/TipsManager.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/TipsManager.java index ad4987dc85c..a184e5465e5 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/TipsManager.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/TipsManager.java @@ -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; } diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.java b/idea/src/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.java index 938c592e079..103bdf2c718 100644 --- a/idea/src/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.java +++ b/idea/src/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.java @@ -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; }