| 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; |
| 12 import '../universe/universe.dart' show Selector; | 13 import '../universe/universe.dart' show Selector; |
| 13 | 14 |
| 14 import '../cps_ir/builtin_operator.dart'; | 15 import '../cps_ir/builtin_operator.dart'; |
| 15 export '../cps_ir/builtin_operator.dart'; | 16 export '../cps_ir/builtin_operator.dart'; |
| 16 | 17 |
| 17 // The Tree language is the target of translation out of the CPS-based IR. | 18 // The Tree language is the target of translation out of the CPS-based IR. |
| 18 // | 19 // |
| 19 // The translation from CPS to Dart consists of several stages. Among the | 20 // The translation from CPS to Dart consists of several stages. Among the |
| 20 // stages are translation to direct style, translation out of SSA, eliminating | 21 // stages are translation to direct style, translation out of SSA, eliminating |
| 21 // unnecessary names, recognizing high-level control constructs. Combining | 22 // unnecessary names, recognizing high-level control constructs. Combining |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 [Statement next]) { | 154 [Statement next]) { |
| 154 return new ExpressionStatement(new Assign(variable, value), next); | 155 return new ExpressionStatement(new Assign(variable, value), next); |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 | 158 |
| 158 /** | 159 /** |
| 159 * Common interface for invocations with arguments. | 160 * Common interface for invocations with arguments. |
| 160 */ | 161 */ |
| 161 abstract class Invoke { | 162 abstract class Invoke { |
| 162 List<Expression> get arguments; | 163 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; |
| 203 final List<Expression> arguments; | 204 final List<Expression> arguments; |
| 204 | 205 |
| 205 /// If true, it is known that the receiver cannot be `null`. | 206 /// If true, it is known that the receiver cannot be `null`. |
| 206 bool receiverIsNotNull = false; | 207 bool receiverIsNotNull = false; |
| 207 | 208 |
| 208 InvokeMethod(this.receiver, this.selector, this.arguments) { | 209 InvokeMethod(this.receiver, this.selector, this.mask, this.arguments) { |
| 209 assert(receiver != null); | 210 assert(receiver != null); |
| 210 } | 211 } |
| 211 | 212 |
| 212 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); | 213 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); |
| 213 accept1(ExpressionVisitor1 visitor, arg) { | 214 accept1(ExpressionVisitor1 visitor, arg) { |
| 214 return visitor.visitInvokeMethod(this, arg); | 215 return visitor.visitInvokeMethod(this, arg); |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. | 219 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 | 1256 |
| 1256 visitUnreachable(Unreachable node) { | 1257 visitUnreachable(Unreachable node) { |
| 1257 return node; | 1258 return node; |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { | 1261 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { |
| 1261 _replaceExpressions(node.arguments); | 1262 _replaceExpressions(node.arguments); |
| 1262 return node; | 1263 return node; |
| 1263 } | 1264 } |
| 1264 } | 1265 } |
| OLD | NEW |