Skip to content

Commit

Permalink
fix(parser): fix async assignment in sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaIT committed Mar 25, 2024
1 parent 9652602 commit 223936e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/parser.ts
Expand Up @@ -3575,6 +3575,8 @@ export function parseAsyncExpression(
if (inNew) report(parser, Errors.InvalidAsyncArrow);
return parseArrowFromIdentifier(parser, context, parser.tokenValue, expr, inNew, canAssign, 0, start, line, column);
}

parser.assignable = AssignmentKind.Assignable;
return expr;
}

Expand Down
1 change: 1 addition & 0 deletions test/parser/declarations/functions.ts
Expand Up @@ -398,6 +398,7 @@ describe('Declarations - Function', () => {
'function f() { const await = 10; }',
'function f(a = async function (x) { await x; }) { a(); } f();',
'function f() {async = 1, a = 2;}',
'function f() {a = 1, async = 2;}',
'function f() {var async = 1; return async;}',
'function f() {let async = 1; return async;}',
'function f() {const async = 1; return async;}',
Expand Down
1 change: 1 addition & 0 deletions test/parser/miscellaneous/pass.ts
Expand Up @@ -2835,6 +2835,7 @@ after = err;
'class X { await() {} }',
'let async = await;',
'async = 1, b = 2;',
'b = 2, async = 1;',
'x = { await: false }',
'yield[100]',
`async
Expand Down

0 comments on commit 223936e

Please sign in to comment.