Fix parenthesis in object as left-hand-side of template (#398)

Fixes #392
master
Christopher Chedeau 2017-01-22 14:33:34 -08:00 committed by GitHub
parent b77703a942
commit bf32905c3f
3 changed files with 14 additions and 0 deletions

View File

@ -417,6 +417,9 @@ FPp.needsParens = function(assumeExpressionContext) {
if (parent.type === "ArrowFunctionExpression" && name === "body") {
return true;
}
if (parent.type === "TaggedTemplateExpression") {
return true;
}
default:
if (

View File

@ -43,6 +43,15 @@ var z = Object(123);
"
`;
exports[`test expression.js 1`] = `
"() => ({}\`\`);
({})\`\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(() => ({})\`\`);
({})\`\`;
"
`;
exports[`test objects.js 1`] = `
"/* @flow */

View File

@ -0,0 +1,2 @@
() => ({}``);
({})``;