diff options
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/output.js b/lib/output.js index 9ac50c08..fe982a7b 100644 --- a/lib/output.js +++ b/lib/output.js @@ -592,7 +592,7 @@ function OutputStream(options) { || p instanceof AST_Call && p.expression === this; }); - PARENS(AST_Seq, function(output){ + 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) @@ -1087,18 +1087,19 @@ function OutputStream(options) { AST_Call.prototype._codegen(self, output); }); - AST_Seq.DEFMETHOD("_do_print", function(output){ - this.car.print(output); - if (this.cdr) { - output.comma(); - if (output.should_break()) { - output.newline(); - output.indent(); + AST_Sequence.DEFMETHOD("_do_print", function(output){ + this.expressions.forEach(function(node, index) { + if (index > 0) { + output.comma(); + if (output.should_break()) { + output.newline(); + output.indent(); + } } - this.cdr.print(output); - } + node.print(output); + }); }); - DEFPRINT(AST_Seq, function(self, output){ + DEFPRINT(AST_Sequence, function(self, output){ self._do_print(output); // var p = output.parent(); // if (p instanceof AST_Statement) { |