Add estree parsing support for export * as A (#11254)

This commit is contained in:
Brian Ng
2020-03-16 16:52:33 -05:00
committed by GitHub
parent 4a4845585c
commit 20d9a10186
7 changed files with 208 additions and 7 deletions

View File

@@ -407,4 +407,28 @@ export default (superClass: Class<Parser>): Class<Parser> =>
super.toReferencedListDeep(exprList, isParenthesizedExpr);
}
parseExport(node: N.Node) {
super.parseExport(node);
switch (node.type) {
case "ExportAllDeclaration":
node.exported = null;
break;
case "ExportNamedDeclaration":
if (
node.specifiers.length === 1 &&
node.specifiers[0].type === "ExportNamespaceSpecifier"
) {
node.type = "ExportAllDeclaration";
node.exported = node.specifiers[0].exported;
delete node.specifiers;
}
break;
}
return node;
}
};