Move fix into #checkBlockScopedCollisions

This commit is contained in:
Justin Ridgewell 2017-08-25 19:23:11 -04:00
parent 48c114169f
commit 4b297907d1
3 changed files with 19 additions and 4 deletions

View File

@ -346,6 +346,10 @@ export default class Scope {
// ignore parameters
if (kind === "param") return;
// Ignore existing binding if it's the name of the current function or
// class expression
if (local.kind === "local") return;
// ignore hoisted functions if there's also a local let
if (kind === "hoisted" && local.kind === "let") return;
@ -520,10 +524,6 @@ export default class Scope {
for (const id of (ids[name]: Array<Object>)) {
let local = this.getOwnBinding(name);
// Ignore existing binding if it's the name of the current function or class
// expression
if (local && local.kind === "local") local = null;
if (local) {
// same identifier so continue safely as we're likely trying to register it
// multiple times

View File

@ -0,0 +1,8 @@
let obj = {
foo: function foo() {
let foo = true;
console.log('foo ran');
}
};
obj.foo();

View File

@ -0,0 +1,7 @@
let obj = {
foo: function foo() {
let foo = true;
console.log('foo ran');
}
};
obj.foo();