Skip to content

Commit

Permalink
mark computed properties in for..of initializers as used. Closes #1238
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Dec 2, 2022
1 parent 635400e commit d941a11
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/compress/drop-unused.js
Expand Up @@ -199,15 +199,14 @@ AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
}
});
}
if (def.value) {
if (def.name instanceof AST_Destructuring) {
def.walk(tw);
} else {
var node_def = def.name.definition();
map_add(initializations, node_def.id, def.value);
if (!node_def.chained && def.name.fixed_value() === def.value) {
fixed_ids.set(node_def.id, def);
}
if (def.name instanceof AST_Destructuring) {
def.walk(tw);
}
if (def.name instanceof AST_SymbolDeclaration && def.value) {
var node_def = def.name.definition();
map_add(initializations, node_def.id, def.value);
if (!node_def.chained && def.name.fixed_value() === def.value) {
fixed_ids.set(node_def.id, def);
}
if (def.value.has_side_effects(compressor)) {
def.value.walk(tw);
Expand Down

0 comments on commit d941a11

Please sign in to comment.