Fix missing parenthesis for typeof and arrow functions (#249)
parent
1c8414e894
commit
86c65d1f81
|
@ -371,11 +371,14 @@ FPp.needsParens = function(assumeExpressionContext) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (parent.type === "MemberExpression") {
|
||||
return true;
|
||||
}
|
||||
switch (parent.type) {
|
||||
case "MemberExpression":
|
||||
case "UnaryExpression":
|
||||
return true;
|
||||
|
||||
return isBinary(parent);
|
||||
default:
|
||||
return isBinary(parent);
|
||||
}
|
||||
|
||||
case "ClassExpression":
|
||||
return parent.type === "ExpressionStatement";
|
||||
|
|
|
@ -27,9 +27,12 @@ var ident = <T>(x: T): T => x;
|
|||
|
||||
exports[`test arrow_function_expression.js 1`] = `
|
||||
"(a => {}).length
|
||||
typeof (() => {});
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
(a => {
|
||||
}).length;
|
||||
typeof (() => {
|
||||
});
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
(a => {}).length
|
||||
typeof (() => {});
|
||||
|
|
Loading…
Reference in New Issue