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.logical_rewriter; | 5 library tree_ir.optimization.logical_rewriter; |
6 | 6 |
7 import '../tree_ir_nodes.dart'; | 7 import '../tree_ir_nodes.dart'; |
8 import 'optimization.dart' show Pass; | 8 import 'optimization.dart' show Pass; |
9 import '../../constants/values.dart' as values; | 9 import '../../constants/values.dart' as values; |
10 | 10 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return node; | 183 return node; |
184 } | 184 } |
185 | 185 |
186 Statement visitWhileTrue(WhileTrue node) { | 186 Statement visitWhileTrue(WhileTrue node) { |
187 fallthrough.push(node); | 187 fallthrough.push(node); |
188 node.body = visitStatement(node.body); | 188 node.body = visitStatement(node.body); |
189 fallthrough.pop(); | 189 fallthrough.pop(); |
190 return node; | 190 return node; |
191 } | 191 } |
192 | 192 |
193 Statement visitFor(For node) { | 193 Statement visitWhileCondition(WhileCondition node) { |
194 fallthrough.push(node); | 194 fallthrough.push(node); |
195 node.condition = makeCondition(node.condition, true, liftNots: false); | 195 node.condition = makeCondition(node.condition, true, liftNots: false); |
196 node.body = visitStatement(node.body); | 196 node.body = visitStatement(node.body); |
197 fallthrough.pop(); | 197 fallthrough.pop(); |
198 node.next = visitStatement(node.next); | 198 node.next = visitStatement(node.next); |
199 return node; | 199 return node; |
200 } | 200 } |
201 | 201 |
202 Statement visitBreak(Break node) { | 202 Statement visitBreak(Break node) { |
203 if (isFallthroughBreak(node)) { | 203 if (isFallthroughBreak(node)) { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 bool isSameVariable(Expression e1, Expression e2) { | 537 bool isSameVariable(Expression e1, Expression e2) { |
538 if (e1 is VariableUse) { | 538 if (e1 is VariableUse) { |
539 return e2 is VariableUse && e1.variable == e2.variable; | 539 return e2 is VariableUse && e1.variable == e2.variable; |
540 } else if (e1 is Assign) { | 540 } else if (e1 is Assign) { |
541 return e2 is VariableUse && e1.variable == e2.variable; | 541 return e2 is VariableUse && e1.variable == e2.variable; |
542 } | 542 } |
543 return false; | 543 return false; |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
OLD | NEW |