Implemented ability to analyze to multiple elements at once
This commit is contained in:
@@ -161,7 +161,7 @@ public interface BindingContext {
|
||||
/**
|
||||
* Has type of current expression has been already resolved
|
||||
*/
|
||||
WritableSlice<KtExpression, Boolean> PROCESSED = Slices.createSimpleSetSlice();
|
||||
WritableSlice<KtExpression, Boolean> PROCESSED = Slices.createSimpleSlice();
|
||||
WritableSlice<KtElement, Boolean> USED_AS_EXPRESSION = Slices.createSimpleSetSlice();
|
||||
WritableSlice<KtElement, Boolean> USED_AS_RESULT_OF_LAMBDA = Slices.createSimpleSetSlice();
|
||||
WritableSlice<KtElement, Boolean> UNREACHABLE_CODE = Slices.createSimpleSetSlice();
|
||||
|
||||
@@ -181,7 +181,7 @@ public class BindingContextUtils {
|
||||
@Nullable
|
||||
public static KotlinTypeInfo getRecordedTypeInfo(@NotNull KtExpression expression, @NotNull BindingContext context) {
|
||||
// noinspection ConstantConditions
|
||||
if (!context.get(BindingContext.PROCESSED, expression)) return null;
|
||||
if (context.get(BindingContext.PROCESSED, expression) != Boolean.TRUE) return null;
|
||||
// NB: should never return null if expression is already processed
|
||||
KotlinTypeInfo result = context.get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
return result != null ? result : TypeInfoFactoryKt.noTypeInfo(DataFlowInfoFactory.EMPTY);
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ public abstract class ExpressionTypingVisitorDispatcher extends KtVisitor<Kotlin
|
||||
result = expression.accept(visitor, context);
|
||||
// Some recursive definitions (object expressions) must put their types in the cache manually:
|
||||
//noinspection ConstantConditions
|
||||
if (context.trace.get(BindingContext.PROCESSED, expression)) {
|
||||
if (context.trace.get(BindingContext.PROCESSED, expression) == Boolean.TRUE) {
|
||||
KotlinType type = context.trace.getBindingContext().getType(expression);
|
||||
return result.replaceType(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user