diff --git a/lib/compress.js b/lib/compress.js index 1e358599f5..5438cc54da 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -601,10 +601,6 @@ Compressor.prototype.compress = function(node) { fn.enclosed.forEach(function(d) { if (fn.variables.get(d.name) === d) return; if (safe_to_read(tw, d)) return; - d.single_use = false; - var fixed = d.fixed; - if (typeof fixed == "function") fixed = fixed(); - if (fixed instanceof AST_Lambda && fixed.safe_ids !== undefined) return; d.fixed = false; }); } diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js index 7f2ec4e881..1e6509e1c5 100644 --- a/test/compress/pure_getters.js +++ b/test/compress/pure_getters.js @@ -1715,3 +1715,39 @@ issue_5856: { } expect_stdout: "PASS" } + +issue_5917: { + options = { + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + toplevel: true, + } + input: { + var a; + console || (a = function() {})(f); + function f() { + a.p; + } + try { + f(); + console.log("FAIL"); + } catch (e) { + console.log("PASS"); + } + } + expect: { + var a; + console || (a = function() {})(f); + function f() { + a.p; + } + try { + f(); + console.log("FAIL"); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" +}