From d9bc6f303c7649811dedd1b5646c83df89c24588 Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Sun, 3 Jul 2016 20:17:03 +0200 Subject: [PATCH] Fix output arrow function with 1 param with default value Fixes #1090 --- lib/output.js | 2 +- test/compress/arrow.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/output.js b/lib/output.js index 60c8dad8..e309f5bd 100644 --- a/lib/output.js +++ b/lib/output.js @@ -909,7 +909,7 @@ function OutputStream(options) { parent instanceof AST_Unary || parent instanceof AST_Call; if (needs_parens) { output.print("(") } - if (self.argnames.length === 1 && self.argnames[0] instanceof AST_Symbol) { + if (self.argnames.length === 1 && self.argnames[0] instanceof AST_Symbol && !self.argnames[0].default) { self.argnames[0].print(output); } else { output.with_parens(function(){ diff --git a/test/compress/arrow.js b/test/compress/arrow.js index c5838537..1a8b17ed 100644 --- a/test/compress/arrow.js +++ b/test/compress/arrow.js @@ -82,4 +82,11 @@ arrow_functions_with_body: { b.join(); }; } -} \ No newline at end of file +} + +arrow_function_with_single_parameter_with_default: { + input: { + var foo = (a = 0) => doSomething(a); + } + expect_exact: "var foo=(a=0)=>doSomething(a);" +}