Remove unneeded parens for FunctionExpression inside LogicalExpression (#399)

master
Brian Ng 2017-01-22 17:00:13 -06:00 committed by Christopher Chedeau
parent bf32905c3f
commit badab37dd1
3 changed files with 9 additions and 2 deletions

View File

@ -399,6 +399,9 @@ FPp.needsParens = function(assumeExpressionContext) {
case "NewExpression":
return name === "callee";
case "LogicalExpression":
return node.type === "ArrowFunctionExpression";
default:
return isBinary(parent);
}

View File

@ -370,7 +370,8 @@ export default (function() {})();
(function() {})()\`\`;
(function() {})\`\`;
new (function() {});
(function() {})
(function() {});
a = function f() {} || b;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(function() {
}).length;
@ -386,6 +387,8 @@ new (function() {
})();
(function() {
});
a = function f() {
} || b;
"
`;

View File

@ -4,4 +4,5 @@ export default (function() {})();
(function() {})()``;
(function() {})``;
new (function() {});
(function() {})
(function() {});
a = function f() {} || b;