Don't parenthesize arrow functions in parameter lists
This commit is contained in:
parent
7f6b5d662b
commit
e6092bcf39
|
|
@ -944,7 +944,7 @@ function OutputStream(options) {
|
||||||
var parent = output.parent();
|
var parent = output.parent();
|
||||||
var needs_parens = parent instanceof AST_Binary ||
|
var needs_parens = parent instanceof AST_Binary ||
|
||||||
parent instanceof AST_Unary ||
|
parent instanceof AST_Unary ||
|
||||||
parent instanceof AST_Call;
|
(parent instanceof AST_Call && self === parent.expression);
|
||||||
if (needs_parens) { output.print("(") }
|
if (needs_parens) { output.print("(") }
|
||||||
if (self.argnames.length === 1 && self.argnames[0] instanceof AST_Symbol && !self.argnames[0].default) {
|
if (self.argnames.length === 1 && self.argnames[0] instanceof AST_Symbol && !self.argnames[0].default) {
|
||||||
self.argnames[0].print(output);
|
self.argnames[0].print(output);
|
||||||
|
|
|
||||||
|
|
@ -390,4 +390,12 @@ regression_cannot_use_of: {
|
||||||
x.of;
|
x.of;
|
||||||
foo(); /* Label statement missing? No prob. */
|
foo(); /* Label statement missing? No prob. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fat_arrow_as_param: {
|
||||||
|
input: {
|
||||||
|
foo(x => x);
|
||||||
|
foo(x => x, y => y);
|
||||||
|
}
|
||||||
|
expect_exact: "foo(x=>x);foo(x=>x,y=>y);"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user