Skip to content

Commit c5a0e31

Browse files
Copilotjogibear9988
andcommitted
Address code review: use indent() for closing brace, consolidate comment method
Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
1 parent d7800ac commit c5a0e31

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/stringify/compiler.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ class Compiler {
393393
) {
394394
buf += '\n';
395395
// Indent for the closing brace (one level less than current)
396-
if (this.level > 2) {
397-
buf += this.indentation.repeat(this.level - 2);
398-
}
396+
this.indent(-1);
397+
buf += this.indent();
398+
this.indent(1);
399399
}
400400
}
401401

@@ -420,10 +420,8 @@ class Compiler {
420420
if (this.compress) {
421421
return this.emit('', node.position);
422422
}
423-
if (this.identity && node.position) {
424-
return this.emit(`/*${node.comment}*/`, node.position);
425-
}
426-
return this.emit(`${this.indent()}/*${node.comment}*/`, node.position);
423+
const indent = this.identity && node.position ? '' : this.indent();
424+
return this.emit(`${indent}/*${node.comment}*/`, node.position);
427425
}
428426

429427
/**

0 commit comments

Comments
 (0)