@@ -6811,7 +6811,7 @@ class Parser {
68116811 this ->throwUnexpectedToken (this ->lookahead );
68126812 }
68136813 this ->consumeSemicolon ();
6814- } else if (this ->lookahead .type == Token::KeywordToken) {
6814+ } else if (this ->lookahead .type == Token::KeywordToken || this -> matchAsyncFunction () ) {
68156815 // export var f = 1;
68166816 auto oldNameCallback = this ->nameDeclaredCallback ;
68176817 AtomicStringVector declaredNames;
@@ -6827,19 +6827,24 @@ class Parser {
68276827 }
68286828 AtomicStringVector declaredName;
68296829 ASTNode declaration = nullptr ;
6830- switch (this ->lookahead .valueKeywordKind ) {
6831- case KeywordKind::LetKeyword:
6832- case KeywordKind::ConstKeyword:
6833- declaration = this ->parseLexicalDeclaration (builder, false );
6834- break ;
6835- case KeywordKind::VarKeyword:
6836- case KeywordKind::ClassKeyword:
6837- case KeywordKind::FunctionKeyword:
6838- declaration = this ->parseStatementListItem (builder);
6839- break ;
6840- default :
6841- this ->throwUnexpectedToken (this ->lookahead );
6842- break ;
6830+
6831+ if (this ->lookahead .type == Token::KeywordToken) {
6832+ switch (this ->lookahead .valueKeywordKind ) {
6833+ case KeywordKind::LetKeyword:
6834+ case KeywordKind::ConstKeyword:
6835+ declaration = this ->parseLexicalDeclaration (builder, false );
6836+ break ;
6837+ case KeywordKind::VarKeyword:
6838+ case KeywordKind::ClassKeyword:
6839+ case KeywordKind::FunctionKeyword:
6840+ declaration = this ->parseStatementListItem (builder);
6841+ break ;
6842+ default :
6843+ this ->throwUnexpectedToken (this ->lookahead );
6844+ break ;
6845+ }
6846+ } else {
6847+ declaration = this ->parseFunctionDeclaration (builder);
68436848 }
68446849
68456850 for (size_t i = 0 ; i < declaredNames.size (); i++) {
@@ -6852,9 +6857,6 @@ class Parser {
68526857 }
68536858 exportDeclaration = this ->finalize (node, builder.createExportNamedDeclarationNode (declaration, ASTNodeList (), nullptr ));
68546859 this ->nameDeclaredCallback = oldNameCallback;
6855- } else if (this ->matchAsyncFunction ()) {
6856- ASTNode declaration = this ->parseFunctionDeclaration (builder);
6857- exportDeclaration = this ->finalize (node, builder.createExportNamedDeclarationNode (declaration, ASTNodeList (), nullptr ));
68586860 } else {
68596861 ASTNodeList specifiers;
68606862 ASTNode source = nullptr ;
0 commit comments