Don't call createSuper in loose mode (it was unused) (#11358)

* Don't call `createSuper` in loose mode (it was unused)

* Update fixtures
This commit is contained in:
Nicolò Ribaudo
2020-04-01 23:08:21 +02:00
committed by GitHub
parent 548cb3ee89
commit 67609a1232
60 changed files with 122 additions and 356 deletions

View File

@@ -546,6 +546,20 @@ export default function transformClass(
// Unshift to ensure that the constructor inheritance is set up before
// any properties can be assigned to the prototype.
if (!classState.isLoose) {
classState.body.unshift(
t.variableDeclaration("var", [
t.variableDeclarator(
superFnId,
t.callExpression(addCreateSuperHelper(classState.file), [
t.cloneNode(classState.classRef),
]),
),
]),
);
}
classState.body.unshift(
t.expressionStatement(
t.callExpression(
@@ -555,14 +569,6 @@ export default function transformClass(
[t.cloneNode(classState.classRef), t.cloneNode(classState.superName)],
),
),
t.variableDeclaration("var", [
t.variableDeclarator(
superFnId,
t.callExpression(addCreateSuperHelper(classState.file), [
t.cloneNode(classState.classRef),
]),
),
]),
);
}