diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-08-16 22:54:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 05:54:27 +0800 |
commit | 23f0dca992d89f5955aa1676ca2569e77315906e (patch) | |
tree | 9657ad15f4cbfa77f79362547de9580c75018fa7 /test/compress | |
parent | 45ab3b51d805f69bb77eb71db6af55139e1415dc (diff) | |
download | tracifyjs-23f0dca992d89f5955aa1676ca2569e77315906e.tar.gz tracifyjs-23f0dca992d89f5955aa1676ca2569e77315906e.zip |
fix corner cases in `collapse_vars` & `dead_code` (#4052)
fixes #4051
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/collapse_vars.js | 19 | ||||
-rw-r--r-- | test/compress/dead-code.js | 21 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 7fc4b768..aa8b89c9 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -8447,3 +8447,22 @@ issue_4047_2: { "NaN", ] } + +issue_4051: { + options = { + collapse_vars: true, + } + input: { + try { + var a = (b = b.p, "FAIL"), b = b; + } catch (e) {} + console.log(a); + } + expect: { + try { + var a = (b = b.p, "FAIL"), b = b; + } catch (e) {} + console.log(a); + } + expect_stdout: "undefined" +} diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 4f731875..89829b65 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -1341,3 +1341,24 @@ issue_3967: { } expect_stdout: "PASS" } + +issue_4051: { + options = { + dead_code: true, + } + input: { + try { + delete (A = A); + } catch (e) { + console.log("PASS"); + } + } + expect: { + try { + delete (A = A); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" +} |