fix corner case in dead_code (#5154)

fixes #5153
This commit is contained in:
Alex Lam S.L
2021-10-25 06:18:16 +08:00
committed by GitHub
parent 25801627be
commit a0250ec923
2 changed files with 106 additions and 8 deletions

View File

@@ -11562,16 +11562,14 @@ merge(Compressor.prototype, {
node = parent;
parent = compressor.parent(level++);
if (parent instanceof AST_Assign) {
var found = false;
if (parent.left instanceof AST_SymbolRef && parent.left.definition() === def) {
if (in_try(level, parent)) break;
return strip_assignment(def);
}
if (parent.left.match_symbol(function(node) {
if (node instanceof AST_PropAccess) return true;
if (!found && node instanceof AST_SymbolRef && node.definition() === def) {
if (in_try(level, parent)) return true;
found = true;
}
})) break;
if (!found) continue;
return strip_assignment(def);
continue;
}
if (parent instanceof AST_Exit) {
if (!local) break;