Remove parens around AwaitExpression in ternary (#346)

master
Brian Ng 2017-01-19 21:18:02 -06:00 committed by Christopher Chedeau
parent d8d5c7bc55
commit 9fc85eb30d
3 changed files with 14 additions and 1 deletions

View File

@ -298,7 +298,6 @@ FPp.needsParens = function(assumeExpressionContext) {
case "SpreadElement":
case "SpreadProperty":
case "NewExpression":
case "ConditionalExpression":
case "MemberExpression":
return true;

View File

@ -550,3 +550,14 @@ async function g() {
}
"
`;
exports[`test conditional-expression.js 1`] = `
"async function f() {
const result = typeof fn === \'function\' ? await fn() : null;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async function f() {
const result = typeof fn === \"function\" ? await fn() : null;
}
"
`;

View File

@ -0,0 +1,3 @@
async function f() {
const result = typeof fn === 'function' ? await fn() : null;
}