Fix output arrow function with 1 param with default value

Fixes #1090
This commit is contained in:
Anthony Van de Gejuchte
2016-07-03 20:17:03 +02:00
committed by Richard van Velzen
parent 6fd9b338dd
commit d9bc6f303c
2 changed files with 9 additions and 2 deletions

View File

@@ -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(){

View File

@@ -82,4 +82,11 @@ arrow_functions_with_body: {
b.join();
};
}
}
}
arrow_function_with_single_parameter_with_default: {
input: {
var foo = (a = 0) => doSomething(a);
}
expect_exact: "var foo=(a=0)=>doSomething(a);"
}