diff options
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/output.js b/lib/output.js index d59176c3..0f8ef1cd 100644 --- a/lib/output.js +++ b/lib/output.js @@ -711,16 +711,23 @@ function OutputStream(options) { PARENS(AST_Sequence, function(output) { 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 ==> 8 - || p instanceof AST_VarDef // var a = (1, 2), b = a + a; ==> b == 4 - || p instanceof AST_PropAccess // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 - || p instanceof AST_Array // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] - || 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) */ - ; + // (foo, bar)() or foo(1, (2, 3), 4) + return p instanceof AST_Call + // !(foo, bar, baz) + || p instanceof AST_Unary + // 1 + (2, 3) + 4 ==> 8 + || p instanceof AST_Binary + // var a = (1, 2), b = a + a; ==> b == 4 + || p instanceof AST_VarDef + // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 + || p instanceof AST_PropAccess && p.expression === this + // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] + || p instanceof AST_Array + // { foo: (1, 2) }.foo ==> 2 + || p instanceof AST_ObjectProperty + // (false, true) ? (a = 10, b = 20) : (c = 30) + // ==> 20 (side effect, set a := 10 and b := 20) + || p instanceof AST_Conditional; }); PARENS(AST_Binary, function(output) { |