Chromium Code Reviews| 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 // The Tree language is the target of translation out of the CPS-based IR. | 15 // The Tree language is the target of translation out of the CPS-based IR. |
| 15 // | 16 // |
| 16 // The translation from CPS to Dart consists of several stages. Among the | 17 // The translation from CPS to Dart consists of several stages. Among the |
| 17 // stages are translation to direct style, translation out of SSA, eliminating | 18 // stages are translation to direct style, translation out of SSA, eliminating |
| 18 // unnecessary names, recognizing high-level control constructs. Combining | 19 // unnecessary names, recognizing high-level control constructs. Combining |
| 19 // these separate concerns is complicated and the constraints of the CPS-based | 20 // these separate concerns is complicated and the constraints of the CPS-based |
| 20 // language do not permit a multi-stage translation. | 21 // language do not permit a multi-stage translation. |
| 21 // | 22 // |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 [Statement next]) { | 151 [Statement next]) { |
| 151 return new ExpressionStatement(new Assign(variable, value), next); | 152 return new ExpressionStatement(new Assign(variable, value), next); |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 | 155 |
| 155 /** | 156 /** |
| 156 * Common interface for invocations with arguments. | 157 * Common interface for invocations with arguments. |
| 157 */ | 158 */ |
| 158 abstract class Invoke { | 159 abstract class Invoke { |
| 159 List<Expression> get arguments; | 160 List<Expression> get arguments; |
| 160 Selector get selector; | 161 //Selector get selector; |
|
karlklose
2015/06/17 12:43:11
Remove field.
Johnni Winther
2015/06/17 13:03:52
Done.
| |
| 161 } | 162 } |
| 162 | 163 |
| 163 /** | 164 /** |
| 164 * A call to a static function or getter/setter to a static field. | 165 * A call to a static function or getter/setter to a static field. |
| 165 * | 166 * |
| 166 * In contrast to the CPS-based IR, the arguments can be arbitrary expressions. | 167 * In contrast to the CPS-based IR, the arguments can be arbitrary expressions. |
| 167 */ | 168 */ |
| 168 class InvokeStatic extends Expression implements Invoke { | 169 class InvokeStatic extends Expression implements Invoke { |
| 169 final Entity target; | 170 final Entity target; |
| 170 final List<Expression> arguments; | 171 final List<Expression> arguments; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 190 | 191 |
| 191 /** | 192 /** |
| 192 * A call to a method, operator, getter, setter or index getter/setter. | 193 * A call to a method, operator, getter, setter or index getter/setter. |
| 193 * | 194 * |
| 194 * If [receiver] is `null`, an error is thrown before the arguments are | 195 * If [receiver] is `null`, an error is thrown before the arguments are |
| 195 * evaluated. This corresponds to the JS evaluation order. | 196 * evaluated. This corresponds to the JS evaluation order. |
| 196 */ | 197 */ |
| 197 class InvokeMethod extends Expression implements Invoke { | 198 class InvokeMethod extends Expression implements Invoke { |
| 198 Expression receiver; | 199 Expression receiver; |
| 199 final Selector selector; | 200 final Selector selector; |
| 201 final TypeMask mask; | |
| 200 final List<Expression> arguments; | 202 final List<Expression> arguments; |
| 201 | 203 |
| 202 /// If true, it is known that the receiver cannot be `null`. | 204 /// If true, it is known that the receiver cannot be `null`. |
| 203 bool receiverIsNotNull = false; | 205 bool receiverIsNotNull = false; |
| 204 | 206 |
| 205 InvokeMethod(this.receiver, this.selector, this.arguments) { | 207 InvokeMethod(this.receiver, this.selector, this.mask, this.arguments) { |
| 206 assert(receiver != null); | 208 assert(receiver != null); |
| 207 } | 209 } |
| 208 | 210 |
| 209 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); | 211 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); |
| 210 accept1(ExpressionVisitor1 visitor, arg) { | 212 accept1(ExpressionVisitor1 visitor, arg) { |
| 211 return visitor.visitInvokeMethod(this, arg); | 213 return visitor.visitInvokeMethod(this, arg); |
| 212 } | 214 } |
| 213 } | 215 } |
| 214 | 216 |
| 215 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. | 217 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 | 1221 |
| 1220 visitCreateInvocationMirror(CreateInvocationMirror node) { | 1222 visitCreateInvocationMirror(CreateInvocationMirror node) { |
| 1221 _replaceExpressions(node.arguments); | 1223 _replaceExpressions(node.arguments); |
| 1222 return node; | 1224 return node; |
| 1223 } | 1225 } |
| 1224 | 1226 |
| 1225 visitUnreachable(Unreachable node) { | 1227 visitUnreachable(Unreachable node) { |
| 1226 return node; | 1228 return node; |
| 1227 } | 1229 } |
| 1228 } | 1230 } |
| OLD | NEW |