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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1609943002: dart2js cps: Fix bug in pulling of assignments into a var. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update status file Created 4 years, 11 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 | tests/isolate/isolate.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index 185b56df8be60a0b5e6a2adf1b48269a266018f9..07c3ff1043cd2658e7e46eb0f808ef570c6ddbcc 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -121,6 +121,9 @@ class CodeGenerator extends tree_ir.StatementVisitor
if (assign.op != null) break; // Compound assignment.
js.VariableUse use = assign.leftHandSide;
+ // Do not touch non-local variables.
+ if (!usedVariableNames.contains(use.name)) break;
+
// We cannot declare a variable more than once.
if (!declaredVariables.add(use.name)) break;
@@ -144,6 +147,9 @@ class CodeGenerator extends tree_ir.StatementVisitor
if (assign.op != null) break pullFromForLoop; // Compound assignment.
js.VariableUse use = assign.leftHandSide;
+ // Do not touch non-local variables.
+ if (!usedVariableNames.contains(use.name)) break pullFromForLoop;
+
// We cannot declare a variable more than once.
if (!declaredVariables.add(use.name)) break pullFromForLoop;
« no previous file with comments | « no previous file | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698