Wrap awaits in unary expressions (#4315)
parent
1f84880fb1
commit
0a22f5ec15
|
@ -317,6 +317,7 @@ function needsParens(path, options) {
|
|||
case "AwaitExpression":
|
||||
switch (parent.type) {
|
||||
case "TaggedTemplateExpression":
|
||||
case "UnaryExpression":
|
||||
case "BinaryExpression":
|
||||
case "LogicalExpression":
|
||||
case "SpreadElement":
|
||||
|
|
|
@ -35,7 +35,7 @@ function *f(){
|
|||
!(yield a);
|
||||
}
|
||||
async function f() {
|
||||
a = !(await f());
|
||||
a = !await f();
|
||||
}
|
||||
async () => {
|
||||
new A(await x);
|
||||
|
@ -52,7 +52,7 @@ function* f() {
|
|||
!(yield a);
|
||||
}
|
||||
async function f() {
|
||||
a = !await f();
|
||||
a = !(await f());
|
||||
}
|
||||
async () => {
|
||||
new A(await x);
|
||||
|
|
|
@ -8,7 +8,7 @@ function *f(){
|
|||
!(yield a);
|
||||
}
|
||||
async function f() {
|
||||
a = !(await f());
|
||||
a = !await f();
|
||||
}
|
||||
async () => {
|
||||
new A(await x);
|
||||
|
|
|
@ -53,9 +53,9 @@ async function f() {
|
|||
// @target: es6
|
||||
async function f() {
|
||||
<number>await 0;
|
||||
typeof await 0;
|
||||
void await 0;
|
||||
await void (<string>typeof (<number>void await 0));
|
||||
typeof (await 0);
|
||||
void (await 0);
|
||||
await void (<string>typeof (<number>void (await 0)));
|
||||
await await 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue