Index: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
index ddaf34ddef5ba9362866db110393ff39be81d8fe..4693bad24e8ef90ed0bb1a6ec76b2455c426fbc1 100644 |
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
@@ -404,6 +404,8 @@ class Conditional extends Expression { |
/// An && or || expression. The operator is internally represented as a boolean |
/// [isAnd] to simplify rewriting of logical operators. |
+/// Note the the result of && and || is one of the arguments, which might not be |
+/// boolean. 'ShortCircuitOperator' might have been a better name. |
class LogicalOperator extends Expression { |
Expression left; |
bool isAnd; |
@@ -742,6 +744,22 @@ class SetField extends Expression { |
accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg); |
} |
+ |
+/// Read the type test property from [object]. The value is truthy/fasly rather |
+/// than bool. [object] must not be `null`. |
+class GetTypeTestProperty extends Expression { |
+ Expression object; |
+ DartType dartType; |
+ |
+ GetTypeTestProperty(this.object, this.dartType); |
+ |
+ accept(ExpressionVisitor visitor) => |
+ visitor.visitGetTypeTestProperty(this); |
+ accept1(ExpressionVisitor1 visitor, arg) => |
+ visitor.visitGetTypeTestProperty(this, arg); |
+} |
+ |
+ |
/// Read the value of a field, possibly provoking its initializer to evaluate, |
/// or tear off a static method. |
class GetStatic extends Expression { |
@@ -975,6 +993,7 @@ abstract class ExpressionVisitor<E> { |
E visitSetField(SetField node); |
E visitGetStatic(GetStatic node); |
E visitSetStatic(SetStatic node); |
+ E visitGetTypeTestProperty(GetTypeTestProperty node); |
E visitCreateBox(CreateBox node); |
E visitCreateInstance(CreateInstance node); |
E visitReifyRuntimeType(ReifyRuntimeType node); |
@@ -1012,6 +1031,7 @@ abstract class ExpressionVisitor1<E, A> { |
E visitSetField(SetField node, A arg); |
E visitGetStatic(GetStatic node, A arg); |
E visitSetStatic(SetStatic node, A arg); |
+ E visitGetTypeTestProperty(GetTypeTestProperty node, A arg); |
E visitCreateBox(CreateBox node, A arg); |
E visitCreateInstance(CreateInstance node, A arg); |
E visitReifyRuntimeType(ReifyRuntimeType node, A arg); |
@@ -1206,6 +1226,10 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor { |
visitExpression(node.value); |
} |
+ visitGetTypeTestProperty(GetTypeTestProperty node) { |
+ visitExpression(node.object); |
+ } |
+ |
visitCreateBox(CreateBox node) { |
} |
@@ -1451,6 +1475,11 @@ class RecursiveTransformer extends Transformer { |
return node; |
} |
+ visitGetTypeTestProperty(GetTypeTestProperty node) { |
+ node.object = visitExpression(node.object); |
+ return node; |
+ } |
+ |
visitCreateBox(CreateBox node) => node; |
visitCreateInstance(CreateInstance node) { |