diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-06-10 01:03:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-10 08:03:17 +0800 |
commit | ce754776706dd6b5ab77e99770ddf05d45faad76 (patch) | |
tree | 2abb62dd7d72dd398b81e5fd500c4cf20dbd1621 /test | |
parent | e70b84895c3d3034b64372b77d343da0c4565c40 (diff) | |
download | tracifyjs-ce754776706dd6b5ab77e99770ddf05d45faad76.tar.gz tracifyjs-ce754776706dd6b5ab77e99770ddf05d45faad76.zip |
fix corner case in `reduce_vars` (#4997)
fixes #4996
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/classes.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js index f9797022..4671fd07 100644 --- a/test/compress/classes.js +++ b/test/compress/classes.js @@ -1748,3 +1748,47 @@ issue_4992: { expect_stdout: "function" node_version: ">=12" } + +issue_4996_1: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = 1; + console.log(new class A { + p = a-- && new A(); + }().p.p); + } + expect: { + var a = 1; + console.log(new class A { + p = a-- && new A(); + }().p.p); + } + expect_stdout: "0" + node_version: ">=12" +} + +issue_4996_2: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = 1; + console.log(new class A { + p = a-- && new A(); + }().p.p); + } + expect: { + var a = 1; + console.log(new class A { + p = a-- && new A(); + }().p.p); + } + expect_stdout: "0" + node_version: ">=12" +} |