clean up #870
This commit is contained in:
parent
8c5e7cf272
commit
717ef280f7
@ -78,19 +78,17 @@ ClassTransformer.prototype.run = function () {
|
||||
className
|
||||
]))
|
||||
]);
|
||||
var constructor;
|
||||
|
||||
var constructor;
|
||||
if (this.node.id) {
|
||||
constructor = t.functionDeclaration(className, [], constructorBody);
|
||||
body.push(constructor);
|
||||
} else {
|
||||
var constructorName = null;
|
||||
// when class has no parent and there is only constructor or nothing then
|
||||
// constructor is not wrapped in closure and has to be named
|
||||
var containsOnlyConstructor = classBody.length === 1 &&
|
||||
classBody[0].key.name === "constructor";
|
||||
if (!this.hasSuper && (classBody.length === 0 ||
|
||||
containsOnlyConstructor)) {
|
||||
// when a class has no parent and there is only a constructor or no body
|
||||
// then the constructor is not wrapped in a closure and needs to be named
|
||||
var containsOnlyConstructor = classBody.length === 1 && classBody[0].key.name === "constructor";
|
||||
if (!this.hasSuper && (classBody.length === 0 || containsOnlyConstructor)) {
|
||||
constructorName = className;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user