Emit parens for await (but not yield) of ternary expressions (#5270)
This commit is contained in:
parent
8c3392f058
commit
e9d7757433
@ -197,6 +197,10 @@ export function ConditionalExpression(node: Object, parent: Object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t.isAwaitExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return UnaryLike(node, parent);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ async function asdf() {
|
||||
(await b)();
|
||||
new (await b)();
|
||||
true ? (await 1) : (await 2);
|
||||
await (1 ? 2 : 3);
|
||||
await (await 1);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ async function asdf() {
|
||||
(await b)();
|
||||
new (await b)();
|
||||
true ? await 1 : await 2;
|
||||
await (1 ? 2 : 3);
|
||||
await await 1;
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ function* asdf() {
|
||||
(yield b)();
|
||||
new (yield b)();
|
||||
(yield 1) ? (yield 2) : (yield 3);
|
||||
yield (1 ? 2 : 3);
|
||||
yield (yield 1);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ function* asdf() {
|
||||
(yield b)();
|
||||
new (yield b)();
|
||||
(yield 1) ? yield 2 : yield 3;
|
||||
yield 1 ? 2 : 3;
|
||||
yield yield 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user