properly register for head variable declaration paths when performing scope tracking - fixes #1524

This commit is contained in:
Sebastian McKenzie 2015-05-14 23:53:04 +01:00
parent 024e4454a1
commit ad44190c6b

View File

@ -463,6 +463,14 @@ export default class Scope {
registerBinding(kind: string, path: TraversalPath) {
if (!kind) throw new ReferenceError("no `kind`");
if (path.isVariableDeclaration()) {
var declarators = path.get("declarations");
for (var declar of (declarators: Array)) {
this.registerBinding(kind, declar);
}
return;
}
var ids = path.getBindingIdentifiers();
for (var name in ids) {