@@ -981,7 +981,10 @@ merge(Compressor.prototype, {
|
|||||||
if (fixed && !modified && !sym.in_arg && safe_to_assign(tw, d)) {
|
if (fixed && !modified && !sym.in_arg && safe_to_assign(tw, d)) {
|
||||||
push_ref(d, sym);
|
push_ref(d, sym);
|
||||||
mark(tw, d);
|
mark(tw, d);
|
||||||
if (d.single_use && left instanceof AST_Destructured) d.single_use = false;
|
if (left instanceof AST_Destructured
|
||||||
|
|| d.orig.length == 1 && d.orig[0] instanceof AST_SymbolDefun) {
|
||||||
|
d.single_use = false;
|
||||||
|
}
|
||||||
tw.loop_ids[d.id] = tw.in_loop;
|
tw.loop_ids[d.id] = tw.in_loop;
|
||||||
mark_escaped(tw, d, sym.scope, node, right, 0, 1);
|
mark_escaped(tw, d, sym.scope, node, right, 0, 1);
|
||||||
sym.fixed = d.fixed = fixed;
|
sym.fixed = d.fixed = fixed;
|
||||||
|
|||||||
@@ -6535,3 +6535,33 @@ issue_5096_4: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5098: {
|
||||||
|
options = {
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function(o) {
|
||||||
|
function f() {
|
||||||
|
f = console.log;
|
||||||
|
if (o.p++)
|
||||||
|
throw "FAIL";
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
})({ p: 0 })();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function(o) {
|
||||||
|
function f() {
|
||||||
|
f = console.log;
|
||||||
|
if (o.p++)
|
||||||
|
throw "FAIL";
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
})({ p: 0 })();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user