diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-08-25 03:39:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 10:39:35 +0800 |
commit | c3aef2361458941a36d217cb3181ade3b777a37e (patch) | |
tree | 3eafad51341480cb600e1c2f081d43f50a750d27 /test | |
parent | db94d21980583714755322d5dd26bb0850801c03 (diff) | |
download | tracifyjs-c3aef2361458941a36d217cb3181ade3b777a37e.tar.gz tracifyjs-c3aef2361458941a36d217cb3181ade3b777a37e.zip |
fix corner case in `reduce_vars` (#5121)
fixes #5120
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/exponentiation.js | 4 | ||||
-rw-r--r-- | test/compress/functions.js | 29 |
2 files changed, 31 insertions, 2 deletions
diff --git a/test/compress/exponentiation.js b/test/compress/exponentiation.js index e945e13e..084e005b 100644 --- a/test/compress/exponentiation.js +++ b/test/compress/exponentiation.js @@ -99,8 +99,8 @@ issue_4664: { expect: { (function f() { new function(a) { - console.log(typeof f, 1073741824, typeof this); - }(A = 0); + console.log(typeof f, a, typeof this); + }((A = 0, 2 ** 30)); })(); } expect_stdout: "function 1073741824 object" diff --git a/test/compress/functions.js b/test/compress/functions.js index 05d175c1..6f596662 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -6600,3 +6600,32 @@ shorter_without_void: { "baz", ] } + +issue_5120: { + options = { + functions: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = function f() { + function g() { + f || g(); + } + g(); + return f.valueOf(); + }; + console.log(a() === a ? "PASS" : "FAIL"); + } + expect: { + function a() { + (function g() { + a || g(); + })(); + return a.valueOf(); + } + console.log(a() === a ? "PASS" : "FAIL"); + } + expect_stdout: "PASS" +} |