diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-26 20:16:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-27 04:16:14 +0800 |
commit | ac26993b5a1546e790d93603d0d7a05740566b07 (patch) | |
tree | 1aa4e1a945a847db8314a5966764c357134cd1d1 /test/compress/let.js | |
parent | ea52339502ac0436532e55a6980df0785736c8fb (diff) | |
download | tracifyjs-ac26993b5a1546e790d93603d0d7a05740566b07.tar.gz tracifyjs-ac26993b5a1546e790d93603d0d7a05740566b07.zip |
fix corner cases with block-scoped functions (#4695)
Diffstat (limited to 'test/compress/let.js')
-rw-r--r-- | test/compress/let.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/compress/let.js b/test/compress/let.js index b5005ebf..04002e9a 100644 --- a/test/compress/let.js +++ b/test/compress/let.js @@ -1357,3 +1357,50 @@ issue_4689: { expect_stdout: "PASS" node_version: ">=4" } + +issue_4691: { + options = { + if_return: true, + toplevel: true, + } + input: { + "use strict"; + function A() {} + A.prototype.f = function() { + if (!this) + return; + let a = "PA"; + function g(b) { + h(a + b); + } + [ "SS" ].forEach(function(c) { + g(c); + }); + }; + function h(d) { + console.log(d); + } + new A().f(); + } + expect: { + "use strict"; + function A() {} + A.prototype.f = function() { + if (this) { + let 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" + node_version: ">=4" +} |