| 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; | 
|  | 
|  |