| 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 } | 751 } |
| 752 | 752 |
| 753 /// Converts a compoundable operator application into the right-hand side for | 753 /// Converts a compoundable operator application into the right-hand side for |
| 754 /// use in a compound assignment, discarding the left-hand value. | 754 /// use in a compound assignment, discarding the left-hand value. |
| 755 /// | 755 /// |
| 756 /// For example, for `x + y + z` it returns `y + z`. | 756 /// For example, for `x + y + z` it returns `y + z`. |
| 757 Expression contractCompoundableBuiltin(ApplyBuiltinOperator e) { | 757 Expression contractCompoundableBuiltin(ApplyBuiltinOperator e) { |
| 758 assert(isCompoundableBuiltin(e)); | 758 assert(isCompoundableBuiltin(e)); |
| 759 if (e.arguments.length > 2) { | 759 if (e.arguments.length > 2) { |
| 760 assert(e.operator == BuiltinOperator.StringConcatenate); | 760 assert(e.operator == BuiltinOperator.StringConcatenate); |
| 761 return new ApplyBuiltinOperator(e.operator, e.arguments.skip(1).toList()); | 761 return new ApplyBuiltinOperator( |
| 762 e.operator, |
| 763 e.arguments.skip(1).toList(), |
| 764 e.sourceInformation); |
| 762 } else { | 765 } else { |
| 763 return e.arguments[1]; | 766 return e.arguments[1]; |
| 764 } | 767 } |
| 765 } | 768 } |
| 766 | 769 |
| 767 void destroyVariableUse(VariableUse node) { | 770 void destroyVariableUse(VariableUse node) { |
| 768 --node.variable.readCount; | 771 --node.variable.readCount; |
| 769 } | 772 } |
| 770 | 773 |
| 771 Expression visitSetField(SetField node) { | 774 Expression visitSetField(SetField node) { |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 } | 1384 } |
| 1382 | 1385 |
| 1383 /// Decrement the reference count for [e] if it is a variable use. | 1386 /// Decrement the reference count for [e] if it is a variable use. |
| 1384 void destroyPrimaryExpression(Expression e) { | 1387 void destroyPrimaryExpression(Expression e) { |
| 1385 if (e is VariableUse) { | 1388 if (e is VariableUse) { |
| 1386 --e.variable.readCount; | 1389 --e.variable.readCount; |
| 1387 } else { | 1390 } else { |
| 1388 assert(e is This); | 1391 assert(e is This); |
| 1389 } | 1392 } |
| 1390 } | 1393 } |
| OLD | NEW |