| Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| index 7f788189c94067f1bc2290eec4351887202fa743..212f5107bbefb3bb74ad4ae084bb2e157e00a93f 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| @@ -44,6 +44,8 @@ class TypeMaskSystem {
|
|
|
| TypeMask numStringBoolType;
|
|
|
| + ClassElement get jsNullClass => backend.jsNullClass;
|
| +
|
| // TODO(karlklose): remove compiler here.
|
| TypeMaskSystem(dart2js.Compiler compiler)
|
| : inferrer = compiler.typesTask,
|
| @@ -1549,6 +1551,23 @@ class TransformingVisitor extends RecursiveVisitor {
|
| visit(body);
|
| }
|
| }
|
| +
|
| + void visitInterceptor(Interceptor node) {
|
| + // Filter out intercepted classes that do not match the input type.
|
| + AbstractValue value = getValue(node.input.definition);
|
| + node.interceptedClasses.retainWhere((ClassElement clazz) {
|
| + if (clazz == typeSystem.jsNullClass) {
|
| + return value.isNullable;
|
| + } else {
|
| + TypeMask classMask = typeSystem.nonNullSubclass(clazz);
|
| + return !typeSystem.areDisjoint(value.type, classMask);
|
| + }
|
| + });
|
| + // Remove the interceptor call if it can only return its input.
|
| + if (node.interceptedClasses.isEmpty) {
|
| + node.input.definition.substituteFor(node);
|
| + }
|
| + }
|
| }
|
|
|
| /**
|
|
|