mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
Issue #2232 - Parse exported async functions.
This commit is contained in:
parent
5b7f259abf
commit
9693552c5c
2 changed files with 19 additions and 3 deletions
|
|
@ -5778,14 +5778,15 @@ Parser<ParseHandler>::exportVariableStatement(uint32_t begin)
|
|||
|
||||
template <typename ParseHandler>
|
||||
typename ParseHandler::UnaryNodeType
|
||||
Parser<ParseHandler>::exportFunctionDeclaration(uint32_t begin)
|
||||
Parser<ParseHandler>::exportFunctionDeclaration(uint32_t begin,
|
||||
FunctionAsyncKind asyncKind /* = SyncFunction */)
|
||||
{
|
||||
if (!abortIfSyntaxParser())
|
||||
return null();
|
||||
|
||||
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION));
|
||||
|
||||
Node kid = functionStmt(pos().begin, YieldIsKeyword, NameRequired);
|
||||
Node kid = functionStmt(pos().begin, YieldIsKeyword, NameRequired, asyncKind);
|
||||
if (!kid)
|
||||
return null();
|
||||
|
||||
|
|
@ -6008,6 +6009,20 @@ Parser<ParseHandler>::exportDeclaration()
|
|||
case TOK_FUNCTION:
|
||||
return exportFunctionDeclaration(begin);
|
||||
|
||||
case TOK_ASYNC: {
|
||||
TokenKind nextSameLine = TOK_EOF;
|
||||
if (!tokenStream.peekTokenSameLine(&nextSameLine))
|
||||
return null();
|
||||
|
||||
if (nextSameLine == TOK_FUNCTION) {
|
||||
tokenStream.consumeKnownToken(TOK_FUNCTION);
|
||||
return exportFunctionDeclaration(begin, AsyncFunction);
|
||||
}
|
||||
|
||||
error(JSMSG_DECLARATION_AFTER_EXPORT);
|
||||
return null();
|
||||
}
|
||||
|
||||
case TOK_CLASS:
|
||||
return exportClassDeclaration(begin);
|
||||
|
||||
|
|
|
|||
|
|
@ -1337,7 +1337,8 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_TYPE)
|
|||
BinaryNodeType exportBatch(uint32_t begin);
|
||||
bool checkLocalExportNames(ListNodeType node);
|
||||
Node exportClause(uint32_t begin);
|
||||
UnaryNodeType exportFunctionDeclaration(uint32_t begin);
|
||||
UnaryNodeType exportFunctionDeclaration(uint32_t begin,
|
||||
FunctionAsyncKind asyncKind = SyncFunction);
|
||||
UnaryNodeType exportVariableStatement(uint32_t begin);
|
||||
UnaryNodeType exportClassDeclaration(uint32_t begin);
|
||||
UnaryNodeType exportLexicalDeclaration(uint32_t begin, DeclarationKind kind);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue