print final semicolon

close #28
This commit is contained in:
Mihai Bazon
2012-11-05 13:09:39 +02:00
parent 8413787efc
commit 85af942d64

View File

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