Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
| 6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
| 7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
| 8 | 8 |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../constants/values.dart' as values show ConstantValue; | 10 import '../constants/values.dart' as values show ConstantValue; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 } | 276 } |
| 277 | 277 |
| 278 /// "as" casts and "is" checks. | 278 /// "as" casts and "is" checks. |
| 279 // We might want to turn "is"-checks into a [Primitive] as it can never diverge. | 279 // We might want to turn "is"-checks into a [Primitive] as it can never diverge. |
| 280 // But then we need to special-case for is-checks with an erroneous .type as | 280 // But then we need to special-case for is-checks with an erroneous .type as |
| 281 // these will throw. | 281 // these will throw. |
| 282 class TypeOperator extends Expression { | 282 class TypeOperator extends Expression { |
| 283 final Reference receiver; | 283 final Reference receiver; |
| 284 final DartType type; | 284 final DartType type; |
| 285 final Reference continuation; | 285 final Reference continuation; |
| 286 final String operator; | 286 final bool isTypeTest; |
|
sigurdm
2014/10/31 11:47:46
add todo: add operator getter.
Johnni Winther
2014/10/31 14:12:13
Done.
| |
| 287 | 287 |
| 288 TypeOperator(this.operator, | 288 TypeOperator(Primitive receiver, |
| 289 Primitive receiver, | 289 this.type, |
| 290 this.type, | 290 Continuation cont, |
| 291 Continuation cont) | 291 {bool this.isTypeTest}) |
| 292 : this.receiver = new Reference(receiver), | 292 : this.receiver = new Reference(receiver), |
| 293 this.continuation = new Reference(cont) { | 293 this.continuation = new Reference(cont) { |
| 294 assert(operator == "is" || operator == "as"); | 294 assert(isTypeTest != null); |
| 295 } | 295 } |
| 296 | 296 |
| 297 bool get isTypeCast => !isTypeTest; | |
| 298 | |
| 297 accept(Visitor visitor) => visitor.visitTypeOperator(this); | 299 accept(Visitor visitor) => visitor.visitTypeOperator(this); |
| 298 } | 300 } |
| 299 | 301 |
| 300 /// Invoke [toString] on each argument and concatenate the results. | 302 /// Invoke [toString] on each argument and concatenate the results. |
| 301 class ConcatenateStrings extends Expression { | 303 class ConcatenateStrings extends Expression { |
| 302 final Reference continuation; | 304 final Reference continuation; |
| 303 final List<Reference> arguments; | 305 final List<Reference> arguments; |
| 304 | 306 |
| 305 ConcatenateStrings(Continuation cont, List<Definition> args) | 307 ConcatenateStrings(Continuation cont, List<Definition> args) |
| 306 : continuation = new Reference(cont), | 308 : continuation = new Reference(cont), |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 release(node.parameters[i]); | 944 release(node.parameters[i]); |
| 943 } | 945 } |
| 944 } | 946 } |
| 945 | 947 |
| 946 void visitIsTrue(IsTrue node) { | 948 void visitIsTrue(IsTrue node) { |
| 947 visitReference(node.value); | 949 visitReference(node.value); |
| 948 } | 950 } |
| 949 | 951 |
| 950 } | 952 } |
| 951 | 953 |
| OLD | NEW |