| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library tree_ir_nodes; | 5 library tree_ir_nodes; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' as values; | 8 import '../constants/values.dart' as values; |
| 9 import '../dart_types.dart' show DartType, GenericType; | 9 import '../dart_types.dart' show DartType, GenericType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Call to a factory or generative constructor. | 177 * Call to a factory or generative constructor. |
| 178 */ | 178 */ |
| 179 class InvokeConstructor extends Expression implements Invoke { | 179 class InvokeConstructor extends Expression implements Invoke { |
| 180 final DartType type; | 180 final DartType type; |
| 181 final FunctionElement target; | 181 final FunctionElement target; |
| 182 final List<Expression> arguments; | 182 final List<Expression> arguments; |
| 183 final Selector selector; | 183 final Selector selector; |
| 184 /// TODO(karlklose): get rid of this field. Instead use the constant's |
| 185 /// expression to find the constructor to be called in dart2dart. |
| 184 final values.ConstantValue constant; | 186 final values.ConstantValue constant; |
| 185 | 187 |
| 186 InvokeConstructor(this.type, this.target, this.selector, this.arguments, | 188 InvokeConstructor(this.type, this.target, this.selector, this.arguments, |
| 187 [this.constant]); | 189 [this.constant]); |
| 188 | 190 |
| 189 ClassElement get targetClass => target.enclosingElement; | 191 ClassElement get targetClass => target.enclosingElement; |
| 190 | 192 |
| 191 accept(ExpressionVisitor visitor) => visitor.visitInvokeConstructor(this); | 193 accept(ExpressionVisitor visitor) => visitor.visitInvokeConstructor(this); |
| 192 accept1(ExpressionVisitor1 visitor, arg) { | 194 accept1(ExpressionVisitor1 visitor, arg) { |
| 193 return visitor.visitInvokeConstructor(this, arg); | 195 return visitor.visitInvokeConstructor(this, arg); |
| 194 } | 196 } |
| 195 } | 197 } |
| 196 | 198 |
| 197 /// Calls [toString] on each argument and concatenates the results. | 199 /// Calls [toString] on each argument and concatenates the results. |
| 198 class ConcatenateStrings extends Expression { | 200 class ConcatenateStrings extends Expression { |
| 199 final List<Expression> arguments; | 201 final List<Expression> arguments; |
| 200 final values.ConstantValue constant; | |
| 201 | 202 |
| 202 ConcatenateStrings(this.arguments, [this.constant]); | 203 ConcatenateStrings(this.arguments); |
| 203 | 204 |
| 204 accept(ExpressionVisitor visitor) => visitor.visitConcatenateStrings(this); | 205 accept(ExpressionVisitor visitor) => visitor.visitConcatenateStrings(this); |
| 205 accept1(ExpressionVisitor1 visitor, arg) { | 206 accept1(ExpressionVisitor1 visitor, arg) { |
| 206 return visitor.visitConcatenateStrings(this, arg); | 207 return visitor.visitConcatenateStrings(this, arg); |
| 207 } | 208 } |
| 208 } | 209 } |
| 209 | 210 |
| 210 /** | 211 /** |
| 211 * A constant. | 212 * A constant. |
| 212 */ | 213 */ |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 visitStatement(node.next); | 920 visitStatement(node.next); |
| 920 } | 921 } |
| 921 | 922 |
| 922 visitCreateBox(CreateBox node) { | 923 visitCreateBox(CreateBox node) { |
| 923 } | 924 } |
| 924 | 925 |
| 925 visitCreateInstance(CreateInstance node) { | 926 visitCreateInstance(CreateInstance node) { |
| 926 node.arguments.forEach(visitExpression); | 927 node.arguments.forEach(visitExpression); |
| 927 } | 928 } |
| 928 } | 929 } |
| OLD | NEW |