diff --git a/src/fast-path.js b/src/fast-path.js index a531a96f..15021084 100644 --- a/src/fast-path.js +++ b/src/fast-path.js @@ -392,6 +392,7 @@ FPp.needsParens = function(assumeExpressionContext) { case "LogicalExpression": case "LogicalExpression": case "NewExpression": + case "ExportDefaultDeclaration": return true; case "CallExpression": diff --git a/tests/export_default/__snapshots__/jsfmt.spec.js.snap b/tests/export_default/__snapshots__/jsfmt.spec.js.snap index 7a5c5da5..ac0cace2 100644 --- a/tests/export_default/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_default/__snapshots__/jsfmt.spec.js.snap @@ -5,6 +5,13 @@ module.exports = require(\"M\"); " `; +exports[`test body.js 1`] = ` +"export default (class {}[1] = 1); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +export default (class {}[1] = 1); +" +`; + exports[`test test.js 1`] = ` "var M = require(\'M\'); var N = require(\'N\'); diff --git a/tests/export_default/body.js b/tests/export_default/body.js new file mode 100644 index 00000000..7a2f3c47 --- /dev/null +++ b/tests/export_default/body.js @@ -0,0 +1 @@ +export default (class {}[1] = 1);