fix duplicate let scoping in functions - fixes #166
This commit is contained in:
parent
c9d9a085f1
commit
7a261a1db1
@ -1,3 +1,7 @@
|
||||
# 1.12.4
|
||||
|
||||
* Fix duplicate let scoping in functions.
|
||||
|
||||
# 1.12.13
|
||||
|
||||
* Support duplicate constants within different block scopes.
|
||||
|
||||
@ -74,7 +74,6 @@ function LetScoping(forParent, block, parent, file, scope) {
|
||||
|
||||
this.letReferences = {};
|
||||
this.body = [];
|
||||
this.info = this.getInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +86,10 @@ LetScoping.prototype.run = function () {
|
||||
if (block._letDone) return;
|
||||
block._letDone = true;
|
||||
|
||||
this.info = this.getInfo();
|
||||
|
||||
// this is a block within a `Function` so we can safely leave it be
|
||||
if (t.isFunction(this.parent)) return;
|
||||
if (t.isFunction(this.parent)) return this.noClosure();
|
||||
|
||||
// this block has no let references so let's clean up
|
||||
if (!this.info.keys.length) return this.noClosure();
|
||||
|
||||
10
test/fixtures/transformation/let-scoping/exec-duplicate-function-scope/exec.js
vendored
Normal file
10
test/fixtures/transformation/let-scoping/exec-duplicate-function-scope/exec.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
function test () {
|
||||
let value = "outer";
|
||||
|
||||
return (function () {
|
||||
let value = "inner";
|
||||
return value;
|
||||
})();
|
||||
}
|
||||
|
||||
assert(test(), "inner");
|
||||
Loading…
x
Reference in New Issue
Block a user