fix corner case in unused (#5090)

fixes #5089
This commit is contained in:
Alex Lam S.L
2021-07-20 18:10:58 +01:00
committed by GitHub
parent 85968dee54
commit 8926a2f327
4 changed files with 58 additions and 5 deletions

View File

@@ -7276,6 +7276,7 @@ merge(Compressor.prototype, {
}
function retain_lhs(node) {
if (node instanceof AST_DefaultValue) return retain_lhs(node.name);
if (node instanceof AST_Destructured) {
if (value === null) {
value = make_node(AST_Number, node, { value: 0 });
@@ -7289,7 +7290,6 @@ merge(Compressor.prototype, {
}
return make_node(AST_DestructuredObject, node, { properties: [] });
}
if (node instanceof AST_DefaultValue) node = node.name;
node.__unused = null;
return node;
}