Skip to content

Commit 922c244

Browse files
fix(javascript): keep the comments of an empty statement the SyntaxTree printer drops
Ported from #22649 so this branch's unit job passes on the current main.
1 parent 049575b commit 922c244

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎lib/javascript/syntax-printer.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41701,6 +41701,8 @@ const installTreePrint = (modules) => {
4170141701
output.in_directive = false;
4170241702
}
4170341703
if (!isEmpty) printNode(statement);
41704+
// terser drops an empty statement's comments with it.
41705+
else output.prepend_comments(statement);
4170441706
if (output.in_directive === true && isStringStatement(statement)) {
4170541707
output.in_directive = false;
4170641708
}

0 commit comments

Comments
 (0)