fix default exported classes without a name (#4518)

* fix default exported classes without a name

This correctly requeues class without name so the es3 transform can
transform the default keyword.

* Replace phabricator issue number with github
This commit is contained in:
Daniel Tschinder
2016-09-18 04:50:54 +02:00
committed by Henry Zhu
parent 590ad4d24f
commit cbbc1c7333
13 changed files with 65 additions and 1 deletions

View File

@@ -267,13 +267,18 @@ export default function () {
]);
} else {
path.replaceWith(buildExportsAssignment(defNode, t.toExpression(declaration.node)));
// Manualy re-queue `export default class {}` expressions so that the ES3 transform
// has an opportunity to convert them. Ideally this would happen automatically from the
// replaceWith above. See #4140 for more info.
path.parentPath.requeue(path.get("expression.left"));
}
} else {
path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node));
// Manualy re-queue `export default foo;` expressions so that the ES3 transform
// has an opportunity to convert them. Ideally this would happen automatically from the
// replaceWith above. See T7166 for more info.
// replaceWith above. See #4140 for more info.
path.parentPath.requeue(path.get("expression.left"));
}
exportDefaultFound = true;