fix duplicate declaration regression - fixes #1130
This commit is contained in:
parent
5fbe147a5e
commit
8af3ea1c43
@ -5,9 +5,9 @@ import * as t from "../types";
|
||||
export default function traverse(parent, opts, scope, state, parentPath) {
|
||||
if (!parent) return;
|
||||
|
||||
if (!opts.noScope && !scope) {
|
||||
if (!opts.noScope && (!scope || !parentPath)) {
|
||||
if (parent.type !== "Program" && parent.type !== "File") {
|
||||
throw new Error(`Must pass a scope unless traversing a Program/File got a ${parent.type} node`);
|
||||
throw new Error(`Must pass a scope and parentPath unless traversing a Program/File got a ${parent.type} node`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -216,9 +216,9 @@ export default class TraversalPath {
|
||||
this.opts = context.opts;
|
||||
}
|
||||
|
||||
this.setScope(file);
|
||||
|
||||
this.type = this.node && this.node.type;
|
||||
|
||||
this.setScope(file);
|
||||
}
|
||||
|
||||
_remove() {
|
||||
|
||||
@ -57,7 +57,8 @@ var blockVariableVisitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (this.isFunctionDeclaration() || this.isBlockScoped()) {
|
||||
state.registerDeclaration(this);
|
||||
} else if (this.isScope()) {
|
||||
}
|
||||
if (this.isScope()) {
|
||||
this.skip();
|
||||
}
|
||||
}
|
||||
@ -100,7 +101,7 @@ export default class Scope {
|
||||
*/
|
||||
|
||||
traverse(node: Object, opts: Object, state?) {
|
||||
traverse(node, opts, this, state);
|
||||
traverse(node, opts, this, state, this.path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user