Fix parens for functions inside TaggedTemplateExpression (#259)

This commit is contained in:
Brian Ng authored and Christopher Chedeau committed 2017-01-16 19:47:13 -08:00
1 parent f603ca4688
commit f0d2ad4508
5 files changed
+9

No files matched your search

+1
View File
@@ -374,6 +374,7 @@ FPp.needsParens = function(assumeExpressionContext) {
switch (parent.type) {
case "MemberExpression":
case "TaggedTemplateExpression":
case "UnaryExpression":
return true;
@@ -30,6 +30,7 @@ exports[`test arrow_function_expression.js 1`] = `
typeof (() => {});
export default (() => {})();
(() => {})()\`\`;
(() => {})\`\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(a => {
}).length;
@@ -39,6 +40,8 @@ export default (() => {
})()
(() => {
})()\`\`;
(() => {
})\`\`;
"
`;
@@ -2,3 +2,4 @@
typeof (() => {});
export default (() => {})();
(() => {})()``;
(() => {})``;
@@ -356,6 +356,7 @@ exports[`test function_expression.js 1`] = `
typeof (function() {});
export default (function() {})();
(function() {})()\`\`;
(function() {})\`\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(function() {
}).length;
@@ -365,6 +366,8 @@ export default (function() {
})()
(function() {
})()\`\`;
(function() {
})\`\`;
"
`;
+1
View File
@@ -2,3 +2,4 @@
typeof (function() {});
export default (function() {})();
(function() {})()``;
(function() {})``;