Parse async do expressions (#13043)

* parse async do expressions

* add test cases

* update test fixtures

* chore: add syntax-async-do-expressions

* generater support

* fix: do not transform async do expressions

* chore: add asyncDoExpressions to missing plugin helpers

* update ast types

* add more test cases

* throw when asyncDoExpressions is enabled but not doExpressions

* avoid add parentheses for async do expressions

* address review comments

* chore: update parser typings
This commit is contained in:
Huáng Jùnliàng
2021-04-07 12:24:33 -04:00
committed by Nicolò Ribaudo
parent f30c99aa24
commit 28d7442aae
76 changed files with 897 additions and 23 deletions

View File

@@ -82,7 +82,8 @@ export function DoExpression(
parent: any,
printStack: Array<any>,
): boolean {
return isFirstInStatement(printStack);
// `async do` can start an expression statement
return !node.async && isFirstInStatement(printStack);
}
export function Binary(node: any, parent: any): boolean {