Fix await parenthesis (#185)
This is the first time I'm adding something inside of fast-path so I'm not sure if it's correct, but it seems more correct than before! Fixes #164master
parent
60c0b52fed
commit
281417ac1d
|
@ -289,6 +289,7 @@ FPp.needsParens = function(assumeExpressionContext) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "AwaitExpression":
|
||||||
case "YieldExpression":
|
case "YieldExpression":
|
||||||
switch (parent.type) {
|
switch (parent.type) {
|
||||||
case "BinaryExpression":
|
case "BinaryExpression":
|
||||||
|
@ -296,13 +297,14 @@ FPp.needsParens = function(assumeExpressionContext) {
|
||||||
case "UnaryExpression":
|
case "UnaryExpression":
|
||||||
case "SpreadElement":
|
case "SpreadElement":
|
||||||
case "SpreadProperty":
|
case "SpreadProperty":
|
||||||
case "CallExpression":
|
|
||||||
case "MemberExpression":
|
|
||||||
case "NewExpression":
|
case "NewExpression":
|
||||||
case "ConditionalExpression":
|
case "ConditionalExpression":
|
||||||
case "YieldExpression":
|
case "MemberExpression":
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case "CallExpression":
|
||||||
|
return parent.callee === node;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,6 +459,13 @@ console.log(x.await);
|
||||||
|
|
||||||
var await = 3;
|
var await = 3;
|
||||||
var y = { await };
|
var y = { await };
|
||||||
|
|
||||||
|
async function f() { (await f()).length }
|
||||||
|
async function g() {
|
||||||
|
invariant(
|
||||||
|
(await driver.navigator.getUrl()).substr(-7)
|
||||||
|
);
|
||||||
|
}
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
async function f() {
|
async function f() {
|
||||||
await 1;
|
await 1;
|
||||||
|
@ -514,5 +521,12 @@ console.log(x.await);
|
||||||
|
|
||||||
var await = 3;
|
var await = 3;
|
||||||
var y = { await };
|
var y = { await };
|
||||||
|
|
||||||
|
async function f() {
|
||||||
|
(await f()).length;
|
||||||
|
}
|
||||||
|
async function g() {
|
||||||
|
invariant((await driver.navigator.getUrl()).substr(-7));
|
||||||
|
}
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -22,3 +22,10 @@ console.log(x.await);
|
||||||
|
|
||||||
var await = 3;
|
var await = 3;
|
||||||
var y = { await };
|
var y = { await };
|
||||||
|
|
||||||
|
async function f() { (await f()).length }
|
||||||
|
async function g() {
|
||||||
|
invariant(
|
||||||
|
(await driver.navigator.getUrl()).substr(-7)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue