| Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
|
| index 19b0543c179877ab2a4d7ba2c7061d8822b6f116..13b28215270d72dd834259a9c3d8c9a0776af93c 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
|
| @@ -587,6 +587,7 @@ class Refinement extends Primitive {
|
| /// to simplify code generation for type tests.
|
| class TypeTest extends Primitive {
|
| Reference<Primitive> value;
|
| +
|
| final DartType dartType;
|
|
|
| /// If [type] is an [InterfaceType], this holds the internal representation of
|
| @@ -605,8 +606,8 @@ class TypeTest extends Primitive {
|
| TypeTest(Primitive value,
|
| this.dartType,
|
| List<Primitive> typeArguments)
|
| - : this.value = new Reference<Primitive>(value),
|
| - this.typeArguments = _referenceList(typeArguments);
|
| + : this.value = new Reference<Primitive>(value),
|
| + this.typeArguments = _referenceList(typeArguments);
|
|
|
| accept(Visitor visitor) => visitor.visitTypeTest(this);
|
|
|
| @@ -614,6 +615,35 @@ class TypeTest extends Primitive {
|
| bool get isSafeForReordering => true;
|
| }
|
|
|
| +/// An "is" type test for a raw type.
|
| +///
|
| +/// Returns `true` if [value] is an instance of [type].
|
| +///
|
| +/// [type] must not be the [Object], `dynamic` or [Null] types (though it might
|
| +/// be a type variable containing one of these types). This design is chosen
|
| +/// to simplify code generation for type tests.
|
| +class TypeTestRaw extends Primitive {
|
| + //
|
| + Reference<Primitive> value;
|
| +
|
| + // Some tests can be performed on the interceptor by testing a property. May
|
| + // be null for other tests. The interceptor may have been optimized via the
|
| + // self-interceptor rule to [value].
|
| + Reference<Primitive> interceptor;
|
| +
|
| + final DartType dartType;
|
| +
|
| + bool usePropertyTest = false;
|
| +
|
| + TypeTestRaw(Primitive value, this.dartType)
|
| + : this.value = new Reference<Primitive>(value);
|
| +
|
| + accept(Visitor visitor) => visitor.visitTypeTestRaw(this);
|
| +
|
| + bool get isSafeForElimination => true;
|
| + bool get isSafeForReordering => true;
|
| +}
|
| +
|
| /// An "as" type cast.
|
| ///
|
| /// If [value] is `null` or is an instance of [type], [continuation] is invoked
|
| @@ -1371,6 +1401,7 @@ abstract class Visitor<T> {
|
| T visitTypeExpression(TypeExpression node);
|
| T visitCreateInvocationMirror(CreateInvocationMirror node);
|
| T visitTypeTest(TypeTest node);
|
| + T visitTypeTestRaw(TypeTestRaw node);
|
| T visitApplyBuiltinOperator(ApplyBuiltinOperator node);
|
| T visitApplyBuiltinMethod(ApplyBuiltinMethod node);
|
| T visitGetLength(GetLength node);
|
| @@ -1499,6 +1530,13 @@ class LeafVisitor implements Visitor {
|
| node.typeArguments.forEach(processReference);
|
| }
|
|
|
| + processTypeTestRaw(TypeTestRaw node) {}
|
| + visitTypeTestRaw(TypeTestRaw node) {
|
| + processTypeTestRaw(node);
|
| + processReference(node.value);
|
| + if (node.interceptor != null) processReference(node.interceptor);
|
| + }
|
| +
|
| processSetMutable(SetMutable node) {}
|
| visitSetMutable(SetMutable node) {
|
| processSetMutable(node);
|
|
|