@@ -797,8 +797,12 @@ merge(Compressor.prototype, {
|
||||
d.recursive_refs++;
|
||||
} else if (value && ref_once(tw, compressor, d)) {
|
||||
d.in_loop = tw.loop_ids[d.id] !== tw.in_loop;
|
||||
d.single_use = value instanceof AST_Lambda && !value.pinned()
|
||||
|| !d.in_loop && d.scope === this.scope && value.is_constant_expression();
|
||||
d.single_use = value instanceof AST_Lambda
|
||||
&& !value.pinned()
|
||||
&& (!d.in_loop || tw.parent() instanceof AST_Call)
|
||||
|| !d.in_loop
|
||||
&& d.scope === this.scope
|
||||
&& value.is_constant_expression();
|
||||
} else {
|
||||
d.single_use = false;
|
||||
}
|
||||
|
||||
@@ -7047,3 +7047,24 @@ issue_3866: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3880: {
|
||||
options = {
|
||||
reduce_funcs: true,
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function(a) {
|
||||
while (a.var ^= 1);
|
||||
console.log("PASS");
|
||||
})(function() {});
|
||||
}
|
||||
expect: {
|
||||
(function(a) {
|
||||
while (a.var ^= 1);
|
||||
console.log("PASS");
|
||||
})(function() {});
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user