Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart

Issue 1226353003: dart2js cps: Bugfix in assignment propagation into branch conditions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698