tweak beautify output (#5044)

This commit is contained in:
Alex Lam S.L
2021-07-03 16:10:39 +01:00
committed by GitHub
parent 1b745494ce
commit 668f96623c
2 changed files with 9 additions and 12 deletions

View File

@@ -980,7 +980,6 @@ function OutputStream(options) {
DEFPRINT(AST_Do, function(output) {
var self = this;
output.print("do");
output.space();
make_block(self.body, output);
output.space();
output.print("while");
@@ -997,7 +996,6 @@ function OutputStream(options) {
output.with_parens(function() {
self.condition.print(output);
});
output.space();
force_statement(self.body, output);
});
DEFPRINT(AST_For, function(output) {
@@ -1027,7 +1025,6 @@ function OutputStream(options) {
self.step.print(output);
}
});
output.space();
force_statement(self.body, output);
});
function print_for_enum(prefix, infix) {
@@ -1042,7 +1039,6 @@ function OutputStream(options) {
output.space();
self.object.print(output);
});
output.space();
force_statement(self.body, output);
};
}
@@ -1056,7 +1052,6 @@ function OutputStream(options) {
output.with_parens(function() {
self.expression.print(output);
});
output.space();
force_statement(self.body, output);
});
DEFPRINT(AST_ExportDeclaration, function(output) {
@@ -1325,16 +1320,16 @@ function OutputStream(options) {
output.with_parens(function() {
self.condition.print(output);
});
output.space();
if (self.alternative) {
make_then(self, output);
output.space();
output.print("else");
output.space();
if (self.alternative instanceof AST_If)
if (self.alternative instanceof AST_If) {
output.space();
self.alternative.print(output);
else
} else {
force_statement(self.alternative, output);
}
} else {
force_statement(self.body, output);
}
@@ -1836,6 +1831,7 @@ function OutputStream(options) {
} else if (stat instanceof AST_EmptyStatement) {
output.force_semicolon();
} else {
output.space();
stat.print(output);
}
}
@@ -1884,6 +1880,7 @@ function OutputStream(options) {
}
function make_block(stmt, output) {
output.space();
if (stmt instanceof AST_EmptyStatement) {
print_braced_empty(stmt, output);
} else if (stmt instanceof AST_BlockStatement) {