| 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 part of tree_ir.optimization; | 5 part of tree_ir.optimization; |
| 6 | 6 |
| 7 /// Rewrites logical expressions to be more compact in the Tree IR. | 7 /// Rewrites logical expressions to be more compact in the Tree IR. |
| 8 /// | 8 /// |
| 9 /// In this class an expression is said to occur in "boolean context" if | 9 /// In this class an expression is said to occur in "boolean context" if |
| 10 /// its result is immediately applied to boolean conversion. | 10 /// its result is immediately applied to boolean conversion. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 Statement visitLabeledStatement(LabeledStatement node) { | 90 Statement visitLabeledStatement(LabeledStatement node) { |
| 91 Statement savedFallthrough = fallthrough; | 91 Statement savedFallthrough = fallthrough; |
| 92 fallthrough = node.next; | 92 fallthrough = node.next; |
| 93 node.body = visitStatement(node.body); | 93 node.body = visitStatement(node.body); |
| 94 fallthrough = savedFallthrough; | 94 fallthrough = savedFallthrough; |
| 95 node.next = visitStatement(node.next); | 95 node.next = visitStatement(node.next); |
| 96 return node; | 96 return node; |
| 97 } | 97 } |
| 98 | 98 |
| 99 Statement visitAssign(Assign node) { | 99 Statement visitAssign(Assign node) { |
| 100 node.definition = visitExpression(node.definition); | 100 node.value = visitExpression(node.value); |
| 101 node.next = visitStatement(node.next); | 101 node.next = visitStatement(node.next); |
| 102 return node; | 102 return node; |
| 103 } | 103 } |
| 104 | 104 |
| 105 Statement visitReturn(Return node) { | 105 Statement visitReturn(Return node) { |
| 106 node.value = visitExpression(node.value); | 106 node.value = visitExpression(node.value); |
| 107 return node; | 107 return node; |
| 108 } | 108 } |
| 109 | 109 |
| 110 Statement visitBreak(Break node) { | 110 Statement visitBreak(Break node) { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 /// Destructively updates each entry of [l] with the result of visiting it. | 500 /// Destructively updates each entry of [l] with the result of visiting it. |
| 501 void _rewriteList(List<Expression> l) { | 501 void _rewriteList(List<Expression> l) { |
| 502 for (int i = 0; i < l.length; i++) { | 502 for (int i = 0; i < l.length; i++) { |
| 503 l[i] = visitExpression(l[i]); | 503 l[i] = visitExpression(l[i]); |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| OLD | NEW |