Chromium Code Reviews| Index: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart |
| diff --git a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart |
| index 8c7a5af2e3cf161e2b3334bfcbc1e211f06c5348..9dd0d2aa211f5db652bd13c9719e2b50c2a1535c 100644 |
| --- a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart |
| +++ b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart |
| @@ -584,17 +584,15 @@ class StatementRewriter extends Transformer implements Pass { |
| } |
| Statement visitIf(If node) { |
| - node.condition = visitExpression(node.condition); |
| - |
| - // Do not propagate assignments into branches. Doing so will lead to code |
| - // duplication. |
| - // TODO(kmillikin): Rethink this. Propagating some assignments |
| - // (e.g. variables) is benign. If they can occur here, they should |
| - // be handled well. |
|
asgerf
2015/07/09 11:19:01
This comment was just outdated. It's not really re
|
| + // Do not propagate assignments into branches. |
| inEmptyEnvironment(() { |
| node.thenStatement = visitStatement(node.thenStatement); |
| node.elseStatement = visitStatement(node.elseStatement); |
| + }); |
| + node.condition = visitExpression(node.condition); |
| + |
| + inEmptyEnvironment(() { |
| tryCollapseIf(node); |
| }); |