more sequence optimizations (lift some sequences above binary/unary expressions so that we can avoid parens)

This commit is contained in:
Mihai Bazon
2012-10-22 11:49:58 +03:00
parent 41be8632d3
commit 30faaf13ed
4 changed files with 102 additions and 1 deletions

View File

@@ -414,7 +414,7 @@ function OutputStream(options) {
var p = output.parent();
return p instanceof AST_Call // (foo, bar)() or foo(1, (2, 3), 4)
|| p instanceof AST_Unary // !(foo, bar, baz)
|| p instanceof AST_Binary // 1 + (2, 3) + 4 ==> 7
|| p instanceof AST_Binary // 1 + (2, 3) + 4 ==> 8
|| p instanceof AST_VarDef // var a = (1, 2), b = a + a; ==> b == 4
|| p instanceof AST_Dot // (1, {foo:2}).foo ==> 2
|| p instanceof AST_Array // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ]