diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-12-05 05:08:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 05:08:37 +0800 |
commit | 9074f05129318c2acc095d8a58c60c0a61ff0cee (patch) | |
tree | 60e1ea08637f35382040a3f689a29cf1b5cc105f /test/compress | |
parent | 04fbb1f94978884128ef1582405a77a1974c6522 (diff) | |
download | tracifyjs-9074f05129318c2acc095d8a58c60c0a61ff0cee.tar.gz tracifyjs-9074f05129318c2acc095d8a58c60c0a61ff0cee.zip |
fix corner case in `collapse_vars` (#3629)
fixes #3628
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/collapse_vars.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 9fe5a93f..16cbadf8 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -7345,3 +7345,57 @@ issue_3626_2: { } expect_stdout: "foo 42 null" } + +issue_3628_1: { + options = { + collapse_vars: true, + } + input: { + var a = "bar", b; + ({ + get p() { + a = "foo"; + }, + q: b = a + }).p; + console.log(a, b); + } + expect: { + var a = "bar", b; + ({ + get p() { + a = "foo"; + }, + q: b = a + }).p; + console.log(a, b); + } + expect_stdout: "foo bar" +} + +issue_3628_2: { + options = { + collapse_vars: true, + } + input: { + var a = "bar", b; + ({ + get p() { + a = "foo"; + }, + q: (b = a, 42) + }).p; + console.log(a, b); + } + expect: { + var a = "bar", b; + ({ + get p() { + a = "foo"; + }, + q: (b = a, 42) + }).p; + console.log(a, b); + } + expect_stdout: "foo bar" +} |