print final semicolon
authorMihai Bazon <mihai@bazon.net>
Mon, 5 Nov 2012 11:09:39 +0000 (13:09 +0200)
committerMihai Bazon <mihai@bazon.net>
Mon, 5 Nov 2012 11:09:39 +0000 (13:09 +0200)
close #28

lib/output.js

index 4b515ec..ab44222 100644 (file)
@@ -137,7 +137,7 @@ function OutputStream(options) {
         str = String(str);
         var ch = str.charAt(0);
         if (might_need_semicolon) {
-            if (";}".indexOf(ch) < 0 && !/[;]$/.test(last)) {
+            if ((!ch || ";}".indexOf(ch) < 0) && !/[;]$/.test(last)) {
                 if (options.semicolons || requireSemicolonChars(ch)) {
                     OUTPUT += ";";
                     current_col++;
@@ -529,6 +529,7 @@ function OutputStream(options) {
     });
     DEFPRINT(AST_Toplevel, function(self, output){
         display_body(self.body, true, output);
+        output.print("");
     });
     DEFPRINT(AST_LabeledStatement, function(self, output){
         self.label.print(output);