Use .append to force-commit semicolons for empty statements.

This commit is contained in:
Logan Smyth
2016-07-14 22:07:40 -07:00
parent bd9bb053c3
commit 1bf76b0f33
2 changed files with 4 additions and 7 deletions

View File

@@ -53,8 +53,8 @@ export default class Printer {
* Add a semicolon to the buffer.
*/
semicolon(): void {
this._append(";", true /* queue */);
semicolon(force: boolean = false): void {
this._append(";", !force /* queue */);
}
/**
@@ -64,7 +64,7 @@ export default class Printer {
rightBrace(): void {
if (!this.endsWith("\n")) this.newline();
if (this.format.minified && !this._lastPrintedIsEmptyStatement) {
if (this.format.minified) {
this._buf.removeLastSemicolon();
}
this.token("}");
@@ -262,8 +262,6 @@ export default class Printer {
print(node, parent, opts = {}) {
if (!node) return;
this._lastPrintedIsEmptyStatement = false;
if (parent && parent._compact) {
node._compact = true;
}