diff options
Diffstat (limited to 'test/compress/const.js')
-rw-r--r-- | test/compress/const.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/compress/const.js b/test/compress/const.js index be49e845..4306fff2 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -1454,3 +1454,47 @@ issue_4689: { expect_stdout: "PASS" node_version: ">=4" } + +issue_4691: { + options = { + if_return: true, + toplevel: true, + } + input: { + function A() {} + A.prototype.f = function() { + if (!this) + return; + const a = "PA"; + function g(b) { + h(a + b); + } + [ "SS" ].forEach(function(c) { + g(c); + }); + }; + function h(d) { + console.log(d); + } + new A().f(); + } + expect: { + function A() {} + A.prototype.f = function() { + if (this) { + const a = "PA"; + [ "SS" ].forEach(function(c) { + g(c); + }); + function g(b) { + h(a + b); + } + } + }; + function h(d) { + console.log(d); + } + new A().f(); + } + expect_stdout: "PASS" +} |