Use .append to force-commit semicolons for empty statements.
This commit is contained in:
parent
bd9bb053c3
commit
1bf76b0f33
@ -137,8 +137,7 @@ export let YieldExpression = buildYieldAwait("yield");
|
||||
export let AwaitExpression = buildYieldAwait("await");
|
||||
|
||||
export function EmptyStatement() {
|
||||
this._lastPrintedIsEmptyStatement = true;
|
||||
this.semicolon();
|
||||
this.semicolon(true /* force */);
|
||||
}
|
||||
|
||||
export function ExpressionStatement(node: Object) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user