check parent for variable collisions when remapping closurified block scopes - fixes #915, closes #922

This commit is contained in:
Sebastian McKenzie 2015-03-02 01:27:58 +11:00
parent 27a8f2d2ea
commit 63f25ab038
3 changed files with 17 additions and 1 deletions

View File

@ -327,7 +327,7 @@ class BlockScoping {
for (var name in outsideRefs) {
var id = outsideRefs[name];
if (this.scope.hasGlobal(id.name)) {
if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) {
delete outsideRefs[id.name];
delete this.letReferences[id.name];

View File

@ -0,0 +1,5 @@
let a = 1;
for (let a = 1; a < 100; a++) {
items.forEach(item => a);
}
console.log(a);

View File

@ -0,0 +1,11 @@
"use strict";
var a = 1;
for (var _a = 1; _a < 100; _a++) {
(function (_a) {
items.forEach(function (item) {
return _a;
});
})(_a);
}
console.log(a);