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

Fixes #392
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-01-22 14:33:34 -08:00
1 parent b77703a942
commit bf32905c3f
3 files changed
+14

No files matched your search

+3
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 (
@@ -43,6 +43,15 @@ var z = Object(123);
"
`;
exports[`test expression.js 1`] = `
"() => ({}\`\`);
({})\`\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(() => ({})\`\`);
({})\`\`;
"
`;
exports[`test objects.js 1`] = `
"/* @flow */
+2
View File
@@ -0,0 +1,2 @@
() => ({}``);
({})``;