| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 node.catchBody = visitStatement(node.catchBody); | 176 node.catchBody = visitStatement(node.catchBody); |
| 177 return node; | 177 return node; |
| 178 } | 178 } |
| 179 | 179 |
| 180 Statement visitExpressionStatement(ExpressionStatement node) { | 180 Statement visitExpressionStatement(ExpressionStatement node) { |
| 181 node.expression = visitExpression(node.expression); | 181 node.expression = visitExpression(node.expression); |
| 182 node.next = visitStatement(node.next); | 182 node.next = visitStatement(node.next); |
| 183 return node; | 183 return node; |
| 184 } | 184 } |
| 185 | 185 |
| 186 | 186 Expression visitVariableUse(VariableUse node) { |
| 187 Expression visitVariable(Variable node) { | |
| 188 return node; | 187 return node; |
| 189 } | 188 } |
| 190 | 189 |
| 191 Expression visitInvokeStatic(InvokeStatic node) { | 190 Expression visitInvokeStatic(InvokeStatic node) { |
| 192 _rewriteList(node.arguments); | 191 _rewriteList(node.arguments); |
| 193 return node; | 192 return node; |
| 194 } | 193 } |
| 195 | 194 |
| 196 Expression visitInvokeMethod(InvokeMethod node) { | 195 Expression visitInvokeMethod(InvokeMethod node) { |
| 197 node.receiver = visitExpression(node.receiver); | 196 node.receiver = visitExpression(node.receiver); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 488 } |
| 490 | 489 |
| 491 /// Destructively updates each entry of [l] with the result of visiting it. | 490 /// Destructively updates each entry of [l] with the result of visiting it. |
| 492 void _rewriteList(List<Expression> l) { | 491 void _rewriteList(List<Expression> l) { |
| 493 for (int i = 0; i < l.length; i++) { | 492 for (int i = 0; i < l.length; i++) { |
| 494 l[i] = visitExpression(l[i]); | 493 l[i] = visitExpression(l[i]); |
| 495 } | 494 } |
| 496 } | 495 } |
| 497 } | 496 } |
| 498 | 497 |
| OLD | NEW |