improve diagnostics on top_retain & mangle.properties (#5622)

closes #5618
This commit is contained in:
Alex Lam S.L
2022-08-18 19:32:21 +01:00
committed by GitHub
parent ac002b6338
commit 4653e8aec0
7 changed files with 100 additions and 8 deletions

View File

@@ -6841,6 +6841,7 @@ Compressor.prototype.compress = function(node) {
if (self instanceof AST_Toplevel && compressor.top_retain) {
self.variables.each(function(def) {
if (compressor.top_retain(def) && !(def.id in in_use_ids)) {
AST_Node.info("Retaining variable {name}", def);
in_use_ids[def.id] = true;
in_use.push(def);
}