@@ -2167,31 +2167,35 @@ export default class StatementParser extends ExpressionParser {
21672167 this . expect ( tt . comma ) ;
21682168 if ( this . eat ( tt . braceR ) ) break ;
21692169 }
2170-
2171- const node = this . startNode ( ) ;
2172- const isMaybeTypeOnly = this . isContextual ( tt . _type ) ;
2173- const isString = this . match ( tt . string ) ;
2174- node . local = this . parseModuleExportName ( ) ;
2175- const canParseAsKeyword = this . parseTypeOnlyImportExportSpecifier (
2176- node ,
2177- /* isImport */ false ,
2178- isString ,
2179- isInTypeExport ,
2180- isMaybeTypeOnly ,
2181- ) ;
2182- if ( canParseAsKeyword && this . eatContextual ( tt . _as ) ) {
2183- node . exported = this . parseModuleExportName ( ) ;
2184- } else if ( isString ) {
2185- node . exported = cloneStringLiteral ( node . local ) ;
2186- } else if ( ! node . exported ) {
2187- node . exported = cloneIdentifier ( node . local ) ;
2188- }
2189- nodes . push ( this . finishNode ( node , "ExportSpecifier" ) ) ;
2170+ const node = this . parseExportSpecifier ( isInTypeExport ) ;
2171+ nodes . push ( node ) ;
21902172 }
21912173
21922174 return nodes ;
21932175 }
21942176
2177+ parseExportSpecifier ( isInTypeExport : boolean ) : N . ExportSpecifier {
2178+ const node = this . startNode ( ) ;
2179+ const isMaybeTypeOnly = this . isContextual ( tt . _type ) ;
2180+ const isString = this . match ( tt . string ) ;
2181+ node . local = this . parseModuleExportName ( ) ;
2182+ const canParseAsKeyword = this . parseTypeOnlyImportExportSpecifier (
2183+ node ,
2184+ /* isImport */ false ,
2185+ isString ,
2186+ isInTypeExport ,
2187+ isMaybeTypeOnly ,
2188+ ) ;
2189+ if ( canParseAsKeyword && this . eatContextual ( tt . _as ) ) {
2190+ node . exported = this . parseModuleExportName ( ) ;
2191+ } else if ( isString ) {
2192+ node . exported = cloneStringLiteral ( node . local ) ;
2193+ } else if ( ! node . exported ) {
2194+ node . exported = cloneIdentifier ( node . local ) ;
2195+ }
2196+ return this . finishNode < N . ExportSpecifier > ( node , "ExportSpecifier" ) ;
2197+ }
2198+
21952199 // https://tc39.es/ecma262/#prod-ModuleExportName
21962200 parseModuleExportName ( ) : N . StringLiteral | N . Identifier {
21972201 if ( this . match ( tt . string ) ) {
0 commit comments