aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/output.js b/lib/output.js
index e5c1c26b..5df1c2c4 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -467,12 +467,14 @@ function OutputStream(options) {
self.body.print(output);
output.semicolon();
});
- DEFPRINT(AST_BlockStatement, function(self, output){
- var body = self.body;
+ function print_bracketed(body, output) {
if (body.length > 0) output.with_block(function(){
display_body(body, false, output);
});
else output.print("{}");
+ };
+ DEFPRINT(AST_BlockStatement, function(self, output){
+ print_bracketed(self.body, output);
});
DEFPRINT(AST_EmptyStatement, function(self, output){
output.semicolon();
@@ -563,7 +565,7 @@ function OutputStream(options) {
});
});
output.space();
- self.body.print(output);
+ print_bracketed(self.body, output);
});
DEFPRINT(AST_Lambda, function(self, output){
self._do_print(output);
@@ -701,7 +703,7 @@ function OutputStream(options) {
DEFPRINT(AST_Try, function(self, output){
output.print("try");
output.space();
- self.btry.print(output);
+ print_bracketed(self.body, output);
if (self.bcatch) {
output.space();
self.bcatch.print(output);
@@ -718,12 +720,12 @@ function OutputStream(options) {
self.argname.print(output);
});
output.space();
- self.body.print(output);
+ print_bracketed(self.body, output);
});
DEFPRINT(AST_Finally, function(self, output){
output.print("finally");
output.space();
- self.body.print(output);
+ print_bracketed(self.body, output);
});
/* -----[ var/const ]----- */