scan assignment value in drop_unused() (#1578)
those were not optimised for `unused` before, which made it necessary for `reduce_vars` to have separate steps for `keep_fnames` docs update by @kzc closes #1577
This commit is contained in:
@@ -1840,6 +1840,7 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
if (drop_vars && node instanceof AST_Definitions && !(tt.parent() instanceof AST_ForIn)) {
|
||||
var def = node.definitions.filter(function(def){
|
||||
if (def.value) def.value = def.value.transform(tt);
|
||||
if (def.name.definition().id in in_use_ids) return true;
|
||||
var w = {
|
||||
name : def.name.name,
|
||||
@@ -2611,10 +2612,6 @@ merge(Compressor.prototype, {
|
||||
if (compressor.option("unused")
|
||||
&& def.references.length == 1
|
||||
&& compressor.find_parent(AST_Scope) === def.scope) {
|
||||
if (!compressor.option("keep_fnames")
|
||||
&& exp.name && exp.name.definition() === def) {
|
||||
exp.name = null;
|
||||
}
|
||||
self.expression = exp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user