Refactoring: extracted 'BindingContext.getDataFlowInfo'
This commit is contained in:
@@ -24,6 +24,7 @@ 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.resolve.bindingContextUtil.BindingContextUtilPackage;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
@@ -145,10 +146,7 @@ public class BindingContextUtils {
|
||||
@Nullable
|
||||
public static JetTypeInfo getRecordedTypeInfo(@NotNull JetExpression expression, @NotNull BindingContext context) {
|
||||
if (!context.get(BindingContext.PROCESSED, expression)) return null;
|
||||
DataFlowInfo dataFlowInfo = context.get(BindingContext.EXPRESSION_DATA_FLOW_INFO, expression);
|
||||
if (dataFlowInfo == null) {
|
||||
dataFlowInfo = DataFlowInfo.EMPTY;
|
||||
}
|
||||
DataFlowInfo dataFlowInfo = BindingContextUtilPackage.getDataFlowInfo(context, expression);
|
||||
JetType type = context.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
return JetTypeInfo.create(type, dataFlowInfo);
|
||||
}
|
||||
|
||||
@@ -54,3 +54,6 @@ public fun <C : ResolutionContext<C>> ResolutionContext<C>.recordScopeAndDataFlo
|
||||
trace.record(BindingContext.EXPRESSION_DATA_FLOW_INFO, expression, dataFlowInfo)
|
||||
}
|
||||
}
|
||||
|
||||
public fun BindingContext.getDataFlowInfo(expression: JetExpression?): DataFlowInfo =
|
||||
expression?.let { this[BindingContext.EXPRESSION_DATA_FLOW_INFO, it] } ?: DataFlowInfo.EMPTY
|
||||
|
||||
Reference in New Issue
Block a user