diff --git a/src/fast-path.js b/src/fast-path.js index d95a1c8c7..da77d6ee2 100644 --- a/src/fast-path.js +++ b/src/fast-path.js @@ -434,6 +434,10 @@ FPp.needsParens = function(assumeExpressionContext) { case "ExportDefaultDeclaration": case "ExpressionStatement": return true; + case "CallExpression": + if (parent.callee === node) { + return true; + } } return false; diff --git a/tests/classes/__snapshots__/jsfmt.spec.js.snap b/tests/classes/__snapshots__/jsfmt.spec.js.snap index d2de13bf1..0a7f5ef2d 100644 --- a/tests/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/classes/__snapshots__/jsfmt.spec.js.snap @@ -87,6 +87,13 @@ exports[`test binary.js 1`] = ` " `; +exports[`test call.js 1`] = ` +"(class {})(class {}); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(class {})(class {}); +" +`; + exports[`test class_shapes.js 1`] = ` "/* @flow */ diff --git a/tests/classes/call.js b/tests/classes/call.js new file mode 100644 index 000000000..d530fa291 --- /dev/null +++ b/tests/classes/call.js @@ -0,0 +1 @@ +(class {})(class {});