diff --git a/src/fast-path.js b/src/fast-path.js index 990d7ed0c..1d34e7421 100644 --- a/src/fast-path.js +++ b/src/fast-path.js @@ -417,6 +417,9 @@ FPp.needsParens = function(assumeExpressionContext) { if (parent.type === "ArrowFunctionExpression" && name === "body") { return true; } + if (parent.type === "TaggedTemplateExpression") { + return true; + } default: if ( diff --git a/tests/objects/__snapshots__/jsfmt.spec.js.snap b/tests/objects/__snapshots__/jsfmt.spec.js.snap index 74d07ce15..c3fa28ebb 100644 --- a/tests/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/objects/__snapshots__/jsfmt.spec.js.snap @@ -43,6 +43,15 @@ var z = Object(123); " `; +exports[`test expression.js 1`] = ` +"() => ({}\`\`); +({})\`\`; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(() => ({})\`\`); +({})\`\`; +" +`; + exports[`test objects.js 1`] = ` "/* @flow */ diff --git a/tests/objects/expression.js b/tests/objects/expression.js new file mode 100644 index 000000000..fd92a69bf --- /dev/null +++ b/tests/objects/expression.js @@ -0,0 +1,2 @@ +() => ({}``); +({})``;