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 523314dff9a8ff5a42e894a276e20df42aae5f3f..41b7bcda507566afd1ae51043dc2fd654d819fc0 100644 |
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart |
@@ -267,16 +267,31 @@ class InvokeConstructor extends Expression implements Invoke { |
} |
} |
+/// Calls [toString] on each argument and concatenates the results. |
+class ConcatenateStrings extends Expression { |
+ final List<Expression> arguments; |
+ |
+ ConcatenateStrings(this.arguments); |
+ |
+ accept(ExpressionVisitor visitor) => visitor.visitConcatenateStrings(this); |
+ accept1(ExpressionVisitor1 visitor, arg) { |
+ return visitor.visitConcatenateStrings(this, arg); |
+ } |
+} |
+ |
/** |
* A constant. |
*/ |
class Constant extends Expression { |
+ final ConstantExpression expression; |
final values.ConstantValue value; |
- Constant(this.value); |
+ Constant(this.expression, this.value); |
Constant.bool(values.BoolConstantValue constantValue) |
- : value = constantValue; |
+ : expression = new BoolConstantExpression( |
+ constantValue.primitiveValue), |
+ value = constantValue; |
accept(ExpressionVisitor visitor) => visitor.visitConstant(this); |
accept1(ExpressionVisitor1 visitor, arg) => visitor.visitConstant(this, arg); |
@@ -843,6 +858,7 @@ abstract class ExpressionVisitor<E> { |
E visitInvokeMethod(InvokeMethod node); |
E visitInvokeMethodDirectly(InvokeMethodDirectly node); |
E visitInvokeConstructor(InvokeConstructor node); |
+ E visitConcatenateStrings(ConcatenateStrings node); |
E visitConstant(Constant node); |
E visitThis(This node); |
E visitConditional(Conditional node); |
@@ -874,6 +890,7 @@ abstract class ExpressionVisitor1<E, A> { |
E visitInvokeMethod(InvokeMethod node, A arg); |
E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg); |
E visitInvokeConstructor(InvokeConstructor node, A arg); |
+ E visitConcatenateStrings(ConcatenateStrings node, A arg); |
E visitConstant(Constant node, A arg); |
E visitThis(This node, A arg); |
E visitConditional(Conditional node, A arg); |
@@ -966,6 +983,10 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor { |
node.arguments.forEach(visitExpression); |
} |
+ visitConcatenateStrings(ConcatenateStrings node) { |
+ node.arguments.forEach(visitExpression); |
+ } |
+ |
visitConstant(Constant node) {} |
visitThis(This node) {} |
@@ -1151,6 +1172,11 @@ class RecursiveTransformer extends Transformer { |
return node; |
} |
+ visitConcatenateStrings(ConcatenateStrings node) { |
+ _replaceExpressions(node.arguments); |
+ return node; |
+ } |
+ |
visitConstant(Constant node) => node; |
visitThis(This node) => node; |