| 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.optimization.statement_rewriter; | 5 library tree_ir.optimization.statement_rewriter; |
| 6 | 6 |
| 7 import 'optimization.dart' show Pass; | 7 import 'optimization.dart' show Pass; |
| 8 import '../tree_ir_nodes.dart'; | 8 import '../tree_ir_nodes.dart'; |
| 9 import '../../io/source_information.dart'; | 9 import '../../io/source_information.dart'; |
| 10 import '../../elements/elements.dart'; | 10 import '../../elements/elements.dart'; |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 730 |
| 731 Expression visitThis(This node) { | 731 Expression visitThis(This node) { |
| 732 return node; | 732 return node; |
| 733 } | 733 } |
| 734 | 734 |
| 735 Expression visitLiteralList(LiteralList node) { | 735 Expression visitLiteralList(LiteralList node) { |
| 736 _rewriteList(node.values); | 736 _rewriteList(node.values); |
| 737 return node; | 737 return node; |
| 738 } | 738 } |
| 739 | 739 |
| 740 Expression visitLiteralMap(LiteralMap node) { | |
| 741 // Process arguments right-to-left, the opposite of evaluation order. | |
| 742 for (LiteralMapEntry entry in node.entries.reversed) { | |
| 743 entry.value = visitExpression(entry.value); | |
| 744 entry.key = visitExpression(entry.key); | |
| 745 } | |
| 746 return node; | |
| 747 } | |
| 748 | |
| 749 Expression visitTypeOperator(TypeOperator node) { | 740 Expression visitTypeOperator(TypeOperator node) { |
| 750 _rewriteList(node.typeArguments); | 741 _rewriteList(node.typeArguments); |
| 751 node.value = visitExpression(node.value); | 742 node.value = visitExpression(node.value); |
| 752 return node; | 743 return node; |
| 753 } | 744 } |
| 754 | 745 |
| 755 bool sameVariable(Expression e1, Expression e2) { | 746 bool sameVariable(Expression e1, Expression e2) { |
| 756 return e1 is VariableUse && e2 is VariableUse && e1.variable == e2.variable; | 747 return e1 is VariableUse && e2 is VariableUse && e1.variable == e2.variable; |
| 757 } | 748 } |
| 758 | 749 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 VariableUseCallback callback; | 1340 VariableUseCallback callback; |
| 1350 | 1341 |
| 1351 VariableUseVisitor(this.callback); | 1342 VariableUseVisitor(this.callback); |
| 1352 | 1343 |
| 1353 visitVariableUse(VariableUse use) => callback(use); | 1344 visitVariableUse(VariableUse use) => callback(use); |
| 1354 | 1345 |
| 1355 static void visit(Expression node, VariableUseCallback callback) { | 1346 static void visit(Expression node, VariableUseCallback callback) { |
| 1356 new VariableUseVisitor(callback).visitExpression(node); | 1347 new VariableUseVisitor(callback).visitExpression(node); |
| 1357 } | 1348 } |
| 1358 } | 1349 } |
| OLD | NEW |