Keep parentheses for logical expression when in await expression (fix #5428) (#5433) (#5453)

This commit is contained in:
Henry Zhu 2017-03-12 21:40:38 -04:00 committed by GitHub
parent 2bb6dff00a
commit b78fc9b4d0
3 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,8 @@ export function Binary(node: Object, parent: Object): boolean {
if (
((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) ||
t.isUnaryLike(parent) ||
(t.isMemberExpression(parent) && parent.object === node)
(t.isMemberExpression(parent) && parent.object === node) ||
t.isAwaitExpression(parent)
) {
return true;
}

View File

@ -5,6 +5,7 @@ async function asdf() {
true ? (await 1) : (await 2);
await (1 ? 2 : 3);
await (await 1);
await (a || b);
}
async function a(b) {

View File

@ -5,6 +5,7 @@ async function asdf() {
true ? await 1 : await 2;
await (1 ? 2 : 3);
await await 1;
await (a || b);
}
async function a(b) {