Refactoring of JetTypeInfo / BindingContext. Loop data flow analysis corrected.
Now BindingContext includes expression type info instead of jump out possible, data flow info and expression type. getType() was added into BindingContext, getType() and recordType() were added into BindingTrace. JetTypeInfo now includes also jump possible flag and jump point data flow info. Old TypeInfoWithJumpInfo deleted. TypeInfoFactory introduced to create JetTypeInfo instances. A pack of extra tests for break / continue in loops added.
This commit is contained in:
@@ -122,7 +122,7 @@ public class KotlinIndicesHelper(
|
||||
if (receiverPair != null) {
|
||||
val (receiverExpression, callType) = receiverPair
|
||||
|
||||
val expressionType = bindingContext[BindingContext.EXPRESSION_TYPE, receiverExpression]
|
||||
val expressionType = bindingContext.getType(receiverExpression)
|
||||
if (expressionType == null || expressionType.isError()) return emptyList()
|
||||
|
||||
val receiverValue = ExpressionReceiver(receiverExpression, expressionType)
|
||||
|
||||
@@ -65,7 +65,7 @@ class SmartCastCalculator(val bindingContext: BindingContext, val containingDecl
|
||||
|
||||
val dataFlowValueToVariable: (DataFlowValue) -> VariableDescriptor?
|
||||
if (receiver != null) {
|
||||
val receiverType = bindingContext[BindingContext.EXPRESSION_TYPE, receiver] ?: return ProcessDataFlowInfoResult()
|
||||
val receiverType = bindingContext.getType(receiver) ?: return ProcessDataFlowInfoResult()
|
||||
val receiverId = DataFlowValueFactory.createDataFlowValue(receiver, receiverType, bindingContext, containingDeclarationOrModule).getId()
|
||||
dataFlowValueToVariable = { value ->
|
||||
val id = value.getId()
|
||||
|
||||
@@ -35,7 +35,7 @@ fun DeclarationDescriptorWithVisibility.isVisible(
|
||||
if (bindingContext == null || element == null) return false
|
||||
|
||||
val receiver = element.getReceiverExpression()
|
||||
val type = receiver?.let { bindingContext.get(BindingContext.EXPRESSION_TYPE, it) }
|
||||
val type = receiver?.let { bindingContext.getType(it) }
|
||||
val explicitReceiver = type?.let { ExpressionReceiver(receiver, it) }
|
||||
|
||||
if (explicitReceiver != null) {
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JetNameSuggester {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.analyze(expression, BodyResolveMode.FULL);
|
||||
JetType jetType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
JetType jetType = bindingContext.getType(expression);
|
||||
if (jetType != null) {
|
||||
addNamesForType(result, jetType, validator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user