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/values.dart' as values; | 7 import '../constants/values.dart' as values; |
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 accept1(ExpressionVisitor1 visitor, arg) { | 389 accept1(ExpressionVisitor1 visitor, arg) { |
390 return visitor.visitConditional(this, arg); | 390 return visitor.visitConditional(this, arg); |
391 } | 391 } |
392 | 392 |
393 String toString() => 'Conditional(condition=$condition,thenExpression=' | 393 String toString() => 'Conditional(condition=$condition,thenExpression=' |
394 '$thenExpression,elseExpression=$elseExpression)'; | 394 '$thenExpression,elseExpression=$elseExpression)'; |
395 } | 395 } |
396 | 396 |
397 /// An && or || expression. The operator is internally represented as a boolean | 397 /// An && or || expression. The operator is internally represented as a boolean |
398 /// [isAnd] to simplify rewriting of logical operators. | 398 /// [isAnd] to simplify rewriting of logical operators. |
399 /// Note the the result of && and || is one of the arguments, which might not be | 399 /// Note the result of && and || is one of the arguments, which might not be |
400 /// boolean. 'ShortCircuitOperator' might have been a better name. | 400 /// boolean. 'ShortCircuitOperator' might have been a better name. |
401 class LogicalOperator extends Expression { | 401 class LogicalOperator extends Expression { |
402 Expression left; | 402 Expression left; |
403 bool isAnd; | 403 bool isAnd; |
404 Expression right; | 404 Expression right; |
405 | 405 |
406 LogicalOperator(this.left, this.right, this.isAnd); | 406 LogicalOperator(this.left, this.right, this.isAnd); |
407 LogicalOperator.and(this.left, this.right) : isAnd = true; | 407 LogicalOperator.and(this.left, this.right) : isAnd = true; |
408 LogicalOperator.or(this.left, this.right) : isAnd = false; | 408 LogicalOperator.or(this.left, this.right) : isAnd = false; |
409 | 409 |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 | 1598 |
1599 /// Number of uses of the current fallthrough target. | 1599 /// Number of uses of the current fallthrough target. |
1600 int get useCount => _stack.last.useCount; | 1600 int get useCount => _stack.last.useCount; |
1601 | 1601 |
1602 /// Indicate that a statement will fall through to the current fallthrough | 1602 /// Indicate that a statement will fall through to the current fallthrough |
1603 /// target. | 1603 /// target. |
1604 void use() { | 1604 void use() { |
1605 ++_stack.last.useCount; | 1605 ++_stack.last.useCount; |
1606 } | 1606 } |
1607 } | 1607 } |
OLD | NEW |