diff options
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/classes.js | 48 | ||||
-rw-r--r-- | test/compress/const.js | 37 | ||||
-rw-r--r-- | test/compress/let.js | 40 |
3 files changed, 125 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js index fe8c7e3c..badcb2e6 100644 --- a/test/compress/classes.js +++ b/test/compress/classes.js @@ -1493,3 +1493,51 @@ mangle_properties: { expect_stdout: "PASS 42" node_version: ">=14.6" } + +issue_4848: { + options = { + if_return: true, + } + input: { + "use strict"; + function f(a) { + a(function() { + new A(); + }); + if (!console) + return; + class A { + constructor() { + console.log("PASS"); + } + } + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect: { + "use strict"; + function f(a) { + a(function() { + new A(); + }); + if (!console) + return; + class A { + constructor() { + console.log("PASS"); + } + } + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect_stdout: "PASS" + node_version: ">=4" +} diff --git a/test/compress/const.js b/test/compress/const.js index 4306fff2..fce6ebea 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -1498,3 +1498,40 @@ issue_4691: { } expect_stdout: "PASS" } + +issue_4848: { + options = { + if_return: true, + } + input: { + function f(a) { + a(function() { + console.log(b); + }); + if (!console) + return; + const b = "PASS"; + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect: { + function f(a) { + a(function() { + console.log(b); + }); + if (!console) + return; + const b = "PASS"; + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect_stdout: "PASS" +} diff --git a/test/compress/let.js b/test/compress/let.js index 90d99524..c59308c4 100644 --- a/test/compress/let.js +++ b/test/compress/let.js @@ -1506,3 +1506,43 @@ issue_4691: { expect_stdout: "PASS" node_version: ">=4" } + +issue_4848: { + options = { + if_return: true, + } + input: { + "use strict"; + function f(a) { + a(function() { + console.log(b); + }); + if (!console) + return; + let b = "PASS"; + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect: { + "use strict"; + function f(a) { + a(function() { + console.log(b); + }); + if (!console) + return; + let b = "PASS"; + } + var g; + f(function(h) { + g = h; + }); + g(); + } + expect_stdout: "PASS" + node_version: ">=4" +} |