fix corner cases in unused (#3519)
This commit is contained in:
@@ -3738,7 +3738,7 @@ merge(Compressor.prototype, {
|
||||
head.push(def);
|
||||
} else {
|
||||
var value = def.value
|
||||
&& (sym.references.length != 1 || !sym.replaced)
|
||||
&& !def.value.single_use
|
||||
&& def.value.drop_side_effect_free(compressor);
|
||||
if (value) {
|
||||
AST_Node.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", template(def.name));
|
||||
@@ -6158,6 +6158,7 @@ merge(Compressor.prototype, {
|
||||
if (single_use && fixed) {
|
||||
def.single_use = false;
|
||||
fixed._squeezed = true;
|
||||
fixed.single_use = true;
|
||||
if (fixed instanceof AST_Defun) {
|
||||
fixed = make_node(AST_Function, fixed, fixed);
|
||||
fixed.name = make_node(AST_SymbolLambda, fixed.name, fixed.name);
|
||||
|
||||
Reference in New Issue
Block a user