From 62b94f297aa87a0efebb2958c29f5b9e4fbd9596 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 15 May 2015 19:11:24 +0100 Subject: [PATCH] don't create a new binding for local class ids, just copy the parents - fixes #1547 --- src/babel/traversal/scope/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/babel/traversal/scope/index.js b/src/babel/traversal/scope/index.js index 1c9ec7b940..316e2494db 100644 --- a/src/babel/traversal/scope/index.js +++ b/src/babel/traversal/scope/index.js @@ -599,8 +599,13 @@ export default class Scope { // Class - if (path.isClass() && path.has("id")) { - this.registerBinding("var", path.get("id")); + 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); } // Function - params, rest