Add parenthesis around sequences in arrow bodies

This commit is contained in:
Richard van Velzen 2016-09-01 10:05:59 +02:00
parent e6092bcf39
commit fd38acae43
2 changed files with 5 additions and 1 deletions

View File

@ -597,6 +597,7 @@ function OutputStream(options) {
|| p instanceof AST_ObjectProperty // { foo: (1, 2) }.foo ==> 2
|| p instanceof AST_Conditional /* (false, true) ? (a = 10, b = 20) : (c = 30)
* ==> 20 (side effect, set a := 10 and b := 20) */
|| p instanceof AST_Arrow // x => (x, x)
;
});

View File

@ -396,6 +396,9 @@ fat_arrow_as_param: {
input: {
foo(x => x);
foo(x => x, y => y);
foo(x => (x, x));
foo(x => (x, x), y => (y, y));
}
expect_exact: "foo(x=>x);foo(x=>x,y=>y);"
expect_exact: "foo(x=>x);foo(x=>x,y=>y);foo(x=>(x,x));foo(x=>(x,x),y=>(y,y));"
}