copy parent class binding to class in the collection visitor

This commit is contained in:
Sebastian McKenzie 2015-06-04 22:07:19 +01:00
parent 4ecda93147
commit 45b0d63d72

View File

@ -83,6 +83,11 @@ var collectorVisitor = {
scope.getBlockParent().registerDeclaration(this);
},
ClassDeclaration(node, parent, scope) {
var name = node.id.name;
scope.bindings[name] = scope.getBinding(name);
},
Block(node, parent, scope) {
var paths = this.get("body");
for (var path of (paths: Array)) {
@ -632,11 +637,6 @@ export default class Scope {
// Class
if (path.isClassDeclaration()) {
var name = path.node.id.name;
this.bindings[name] = this.parent.bindings[name];
}
if (path.isClassExpression() && path.has("id")) {
this.registerBinding("var", path);
}