| 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, InterfaceType, TypeVariableType; | 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 11 import '../io/source_information.dart' show SourceInformation; | 11 import '../io/source_information.dart' show SourceInformation; |
| 12 import '../types/types.dart' show TypeMask; | |
| 13 import '../universe/universe.dart' show Selector; | 12 import '../universe/universe.dart' show Selector; |
| 14 | 13 |
| 15 import '../cps_ir/builtin_operator.dart'; | 14 import '../cps_ir/builtin_operator.dart'; |
| 16 export '../cps_ir/builtin_operator.dart'; | 15 export '../cps_ir/builtin_operator.dart'; |
| 17 | 16 |
| 18 // The Tree language is the target of translation out of the CPS-based IR. | 17 // The Tree language is the target of translation out of the CPS-based IR. |
| 19 // | 18 // |
| 20 // The translation from CPS to Dart consists of several stages. Among the | 19 // The translation from CPS to Dart consists of several stages. Among the |
| 21 // stages are translation to direct style, translation out of SSA, eliminating | 20 // stages are translation to direct style, translation out of SSA, eliminating |
| 22 // unnecessary names, recognizing high-level control constructs. Combining | 21 // unnecessary names, recognizing high-level control constructs. Combining |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 [Statement next]) { | 153 [Statement next]) { |
| 155 return new ExpressionStatement(new Assign(variable, value), next); | 154 return new ExpressionStatement(new Assign(variable, value), next); |
| 156 } | 155 } |
| 157 } | 156 } |
| 158 | 157 |
| 159 /** | 158 /** |
| 160 * Common interface for invocations with arguments. | 159 * Common interface for invocations with arguments. |
| 161 */ | 160 */ |
| 162 abstract class Invoke { | 161 abstract class Invoke { |
| 163 List<Expression> get arguments; | 162 List<Expression> get arguments; |
| 163 Selector get selector; |
| 164 } | 164 } |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * A call to a static function or getter/setter to a static field. | 167 * A call to a static function or getter/setter to a static field. |
| 168 * | 168 * |
| 169 * In contrast to the CPS-based IR, the arguments can be arbitrary expressions. | 169 * In contrast to the CPS-based IR, the arguments can be arbitrary expressions. |
| 170 */ | 170 */ |
| 171 class InvokeStatic extends Expression implements Invoke { | 171 class InvokeStatic extends Expression implements Invoke { |
| 172 final Entity target; | 172 final Entity target; |
| 173 final List<Expression> arguments; | 173 final List<Expression> arguments; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 193 | 193 |
| 194 /** | 194 /** |
| 195 * A call to a method, operator, getter, setter or index getter/setter. | 195 * A call to a method, operator, getter, setter or index getter/setter. |
| 196 * | 196 * |
| 197 * If [receiver] is `null`, an error is thrown before the arguments are | 197 * If [receiver] is `null`, an error is thrown before the arguments are |
| 198 * evaluated. This corresponds to the JS evaluation order. | 198 * evaluated. This corresponds to the JS evaluation order. |
| 199 */ | 199 */ |
| 200 class InvokeMethod extends Expression implements Invoke { | 200 class InvokeMethod extends Expression implements Invoke { |
| 201 Expression receiver; | 201 Expression receiver; |
| 202 final Selector selector; | 202 final Selector selector; |
| 203 final TypeMask mask; | |
| 204 final List<Expression> arguments; | 203 final List<Expression> arguments; |
| 205 | 204 |
| 206 /// If true, it is known that the receiver cannot be `null`. | 205 /// If true, it is known that the receiver cannot be `null`. |
| 207 bool receiverIsNotNull = false; | 206 bool receiverIsNotNull = false; |
| 208 | 207 |
| 209 InvokeMethod(this.receiver, this.selector, this.mask, this.arguments) { | 208 InvokeMethod(this.receiver, this.selector, this.arguments) { |
| 210 assert(receiver != null); | 209 assert(receiver != null); |
| 211 } | 210 } |
| 212 | 211 |
| 213 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); | 212 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); |
| 214 accept1(ExpressionVisitor1 visitor, arg) { | 213 accept1(ExpressionVisitor1 visitor, arg) { |
| 215 return visitor.visitInvokeMethod(this, arg); | 214 return visitor.visitInvokeMethod(this, arg); |
| 216 } | 215 } |
| 217 } | 216 } |
| 218 | 217 |
| 219 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. | 218 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 | 1255 |
| 1257 visitUnreachable(Unreachable node) { | 1256 visitUnreachable(Unreachable node) { |
| 1258 return node; | 1257 return node; |
| 1259 } | 1258 } |
| 1260 | 1259 |
| 1261 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { | 1260 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { |
| 1262 _replaceExpressions(node.arguments); | 1261 _replaceExpressions(node.arguments); |
| 1263 return node; | 1262 return node; |
| 1264 } | 1263 } |
| 1265 } | 1264 } |
| OLD | NEW |