fix remaining outer binding identifier issues

This commit is contained in:
Sebastian McKenzie 2015-11-03 03:13:39 +00:00
parent 64a9a6027e
commit 8ec3e16794
2 changed files with 18 additions and 5 deletions

View File

@ -402,7 +402,7 @@ export default class Scope {
if (path.isLabeledStatement()) {
this.registerBinding("label", path);
} else if (path.isFunctionDeclaration()) {
this.registerBinding("hoisted", path.get("id"), true);
this.registerBinding("hoisted", path.get("id"), path);
} else if (path.isVariableDeclaration()) {
let declarations = path.get("declarations");
for (let declar of (declarations: Array)) {

View File

@ -27,15 +27,28 @@ export function getBindingIdentifiers(
} else {
ids[id.name] = id;
}
} else if (t.isExportDeclaration(id)) {
continue;
}
if (t.isExportDeclaration(id)) {
if (t.isDeclaration(node.declaration)) {
search.push(node.declaration);
}
} else if (outerOnly) {
if (t.isFunction(id)) {
continue;
}
if (outerOnly) {
if (t.isFunctionDeclaration(id)) {
search.push(id.id);
continue;
}
} else if (keys) {
if (t.isFunctionExpression(id)) {
continue;
}
}
if (keys) {
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (id[key]) {