fix corner case in unused (#5446)

fixes #5444
This commit is contained in:
Alex Lam S.L
2022-05-16 02:13:30 +01:00
committed by GitHub
parent 31167da1a9
commit fc6a66836a
2 changed files with 20 additions and 0 deletions

View File

@@ -7301,6 +7301,13 @@ Compressor.prototype.compress = function(node) {
}
}, function(node, in_list) {
if (node instanceof AST_BlockStatement) return trim_block(node, tt.parent(), in_list);
if (node instanceof AST_ExportDeclaration) {
var block = node.body;
if (!(block instanceof AST_BlockStatement)) return;
node.body = block.body.pop();
block.body.push(node);
return in_list ? List.splice(block.body) : block;
}
if (node instanceof AST_For) return patch_for_init(node, in_list);
if (node instanceof AST_ForIn) {
if (!drop_vars || !compressor.option("loops")) return;