| 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 /** | 7 /** |
| 8 * Performs the following transformations on the tree: | 8 * Performs the following transformations on the tree: |
| 9 * - Assignment propagation | 9 * - Assignment propagation |
| 10 * - If-to-conditional conversion | 10 * - If-to-conditional conversion |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 }); | 413 }); |
| 414 return node; | 414 return node; |
| 415 } | 415 } |
| 416 | 416 |
| 417 Statement visitWhileCondition(WhileCondition node) { | 417 Statement visitWhileCondition(WhileCondition node) { |
| 418 // Not introduced yet | 418 // Not introduced yet |
| 419 throw "Unexpected WhileCondition in StatementRewriter"; | 419 throw "Unexpected WhileCondition in StatementRewriter"; |
| 420 } | 420 } |
| 421 | 421 |
| 422 Statement visitTry(Try node) { | 422 Statement visitTry(Try node) { |
| 423 Set<Label> saved = safeForInlining; | 423 inEmptyEnvironment(() { |
| 424 safeForInlining = new Set<Label>(); | 424 Set<Label> saved = safeForInlining; |
| 425 node.tryBody = visitStatement(node.tryBody); | 425 safeForInlining = new Set<Label>(); |
| 426 safeForInlining = saved; | 426 node.tryBody = visitStatement(node.tryBody); |
| 427 node.catchBody = visitStatement(node.catchBody); | 427 safeForInlining = saved; |
| 428 node.catchBody = visitStatement(node.catchBody); |
| 429 }); |
| 428 return node; | 430 return node; |
| 429 } | 431 } |
| 430 | 432 |
| 431 Expression visitConstant(Constant node) { | 433 Expression visitConstant(Constant node) { |
| 432 return node; | 434 return node; |
| 433 } | 435 } |
| 434 | 436 |
| 435 Expression visitThis(This node) { | 437 Expression visitThis(This node) { |
| 436 return node; | 438 return node; |
| 437 } | 439 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 } | 671 } |
| 670 | 672 |
| 671 Expression makeCondition(Expression e, bool polarity) { | 673 Expression makeCondition(Expression e, bool polarity) { |
| 672 return polarity ? e : new Not(e); | 674 return polarity ? e : new Not(e); |
| 673 } | 675 } |
| 674 | 676 |
| 675 Statement getBranch(If node, bool polarity) { | 677 Statement getBranch(If node, bool polarity) { |
| 676 return polarity ? node.thenStatement : node.elseStatement; | 678 return polarity ? node.thenStatement : node.elseStatement; |
| 677 } | 679 } |
| 678 } | 680 } |
| OLD | NEW |