Revert "Use a functionExpression with class decorators. Fixes #1161."

This reverts commit f8d56d9612.
This commit is contained in:
Sebastian McKenzie
2015-04-07 04:40:39 -07:00
parent fc34d5a9b0
commit 0cb5a7c91e
3 changed files with 11 additions and 37 deletions

View File

@@ -30,7 +30,7 @@ var collectPropertyReferencesVisitor = {
}
if (this.isReferenced() && scope.getBinding(node.name) === state.scope.getBinding(node.name)) {
state.references[node.name] = true;
state.references[node.name] = true;;
}
}
}
@@ -140,7 +140,7 @@ class ClassTransformer {
var constructorBody = this.constructorBody = t.blockStatement([]);
var constructor;
if (this.className && !this.node.decorators) {
if (this.className) {
constructor = t.functionDeclaration(this.className, [], constructorBody);
body.push(constructor);
} else {
@@ -189,14 +189,6 @@ class ClassTransformer {
}
if (this.className) {
if (decorators) {
constructor = t.functionExpression(this.className, constructor.params, constructorBody);
body.unshift(t.variableDeclaration("var", [
t.variableDeclarator(classRef, constructor)
]));
}
// named class with only a constructor
if (body.length === 1) return t.toExpression(body[0]);
} else {