diff --git a/js/parse.go b/js/parse.go index 0e24e9e..ea6475b 100644 --- a/js/parse.go +++ b/js/parse.go @@ -828,15 +828,17 @@ func (p *Parser) parseExportStmt() (exportStmt ExportStmt) { exportStmt.Default = true p.next() if p.tt == FunctionToken { + // hoistable declaration exportStmt.Decl = p.parseFuncDecl() } else if p.tt == AsyncToken { // async function or async arrow function async := p.data p.next() if p.tt == FunctionToken && !p.prevLT { + // hoistable declaration exportStmt.Decl = p.parseAsyncFuncDecl() } else { // expression - exportStmt.Decl = p.parseAsyncExpression(OpExpr, async) + exportStmt.Decl = p.parseAsyncExpression(OpAssign, async) } } else if p.tt == ClassToken { exportStmt.Decl = p.parseClassDecl() diff --git a/js/parse_test.go b/js/parse_test.go index 171866e..0bf6d42 100644 --- a/js/parse_test.go +++ b/js/parse_test.go @@ -570,6 +570,7 @@ func TestParseError(t *testing.T) { {"export {} from", "expected String instead of EOF in export statement"}, {"export {} from", "expected String instead of EOF in export statement"}, {"export async", "expected function instead of EOF in export statement"}, + {"export default async=>a,b", "unexpected , in expression"}, {"throw", "unexpected EOF in expression"}, {"throw\n", "unexpected newline in throw statement"}, {"#private", "expected in instead of EOF in relational expression"},