Index: pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
index a84d28d4ba5cd333e83868f839722da0da625407..426f56866f49bed10891a1c825321c696d5c602a 100644 |
--- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
+++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
@@ -42,6 +42,7 @@ class TypeMaskSystem { |
TypeMask get extendableNativeListType => backend.extendableArrayType; |
TypeMask numStringBoolType; |
+ TypeMask interceptorType; |
ClassElement get jsNullClass => backend.jsNullClass; |
@@ -63,6 +64,9 @@ class TypeMaskSystem { |
numStringBoolType = |
new TypeMask.unionOf(<TypeMask>[anyNum, anyString, anyBool], |
classWorld); |
+ |
+ interceptorType = new TypeMask.nonNullSubtype( |
+ backend.jsInterceptorClass, classWorld); |
} |
bool methodUsesReceiverArgument(FunctionElement function) { |
@@ -199,6 +203,9 @@ class TypeMaskSystem { |
return t.satisfies(backend.jsIntClass, classWorld); |
} |
+ // TODO(sra): Find a better name. 'NativeList' is a bad name because there |
+ // are many native classes in dart:html that implement List but are not (and |
+ // should not be) included in this predicate. |
bool isDefinitelyNativeList(TypeMask t, {bool allowNull: false}) { |
if (!allowNull && t.isNullable) return false; |
return t.nonNullable().satisfies(backend.jsArrayClass, classWorld); |
@@ -225,6 +232,11 @@ class TypeMaskSystem { |
return t.nonNullable().satisfies(backend.jsIndexableClass, classWorld); |
} |
+ bool isDefinitelyNotIntercepted(TypeMask t, {bool allowNull: false}) { |
+ if (!allowNull && t.isNullable) return false; |
+ return areDisjoint(t, interceptorType); |
+ } |
+ |
bool areDisjoint(TypeMask leftType, TypeMask rightType) { |
TypeMask intersection = leftType.intersection(rightType, classWorld); |
return intersection.isEmpty && !intersection.isNullable; |