| 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 logical_rewriter; | 5 library logical_rewriter; |
| 6 | 6 |
| 7 import '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import 'tree_ir_nodes.dart'; | 8 import 'tree_ir_nodes.dart'; |
| 9 | 9 |
| 10 /// Rewrites logical expressions to be more compact in the Tree IR. | 10 /// Rewrites logical expressions to be more compact in the Tree IR. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 _rewriteList(node.arguments); | 190 _rewriteList(node.arguments); |
| 191 return node; | 191 return node; |
| 192 } | 192 } |
| 193 | 193 |
| 194 Expression visitLiteralList(LiteralList node) { | 194 Expression visitLiteralList(LiteralList node) { |
| 195 _rewriteList(node.values); | 195 _rewriteList(node.values); |
| 196 return node; | 196 return node; |
| 197 } | 197 } |
| 198 | 198 |
| 199 Expression visitLiteralMap(LiteralMap node) { | 199 Expression visitLiteralMap(LiteralMap node) { |
| 200 _rewriteList(node.keys); | 200 node.entries.forEach((LiteralMapEntry entry) { |
| 201 _rewriteList(node.values); | 201 entry.key = visitExpression(entry.key); |
| 202 entry.value = visitExpression(entry.value); |
| 203 }); |
| 202 return node; | 204 return node; |
| 203 } | 205 } |
| 204 | 206 |
| 205 Expression visitTypeOperator(TypeOperator node) { | 207 Expression visitTypeOperator(TypeOperator node) { |
| 206 node.receiver = visitExpression(node.receiver); | 208 node.receiver = visitExpression(node.receiver); |
| 207 return node; | 209 return node; |
| 208 } | 210 } |
| 209 | 211 |
| 210 Expression visitConstant(Constant node) { | 212 Expression visitConstant(Constant node) { |
| 211 return node; | 213 return node; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 444 } |
| 443 | 445 |
| 444 /// Destructively updates each entry of [l] with the result of visiting it. | 446 /// Destructively updates each entry of [l] with the result of visiting it. |
| 445 void _rewriteList(List<Expression> l) { | 447 void _rewriteList(List<Expression> l) { |
| 446 for (int i = 0; i < l.length; i++) { | 448 for (int i = 0; i < l.length; i++) { |
| 447 l[i] = visitExpression(l[i]); | 449 l[i] = visitExpression(l[i]); |
| 448 } | 450 } |
| 449 } | 451 } |
| 450 } | 452 } |
| 451 | 453 |
| OLD | NEW |