aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/output.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/output.js b/lib/output.js
index c0f10523..5c11088b 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -960,24 +960,24 @@ function OutputStream(options) {
self.expression.print(output);
});
output.space();
- if (self.body.length > 0) output.with_block(function(){
- self.body.forEach(function(stmt, i){
- if (i) output.newline();
+ var last = self.body.length - 1;
+ if (last < 0) output.print("{}");
+ else output.with_block(function(){
+ self.body.forEach(function(branch, i){
output.indent(true);
- stmt.print(output);
+ branch.print(output);
+ if (i < last && branch.body.length > 0)
+ output.newline();
});
});
- else output.print("{}");
});
AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output){
- if (this.body.length > 0) {
+ output.newline();
+ this.body.forEach(function(stmt){
+ output.indent();
+ stmt.print(output);
output.newline();
- this.body.forEach(function(stmt){
- output.indent();
- stmt.print(output);
- output.newline();
- });
- }
+ });
});
DEFPRINT(AST_Default, function(self, output){
output.print("default:");