diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-11-20 12:54:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 12:54:49 +0800 |
commit | 81caadb70900654d309f4750d8d0fbfb8f97a99a (patch) | |
tree | 85e448d64237e9929fdb7e032358a0b3fcd8c76f /test | |
parent | d959e0b86ff36156be2e7ec2cffdd57f1e30e8dd (diff) | |
download | tracifyjs-81caadb70900654d309f4750d8d0fbfb8f97a99a.tar.gz tracifyjs-81caadb70900654d309f4750d8d0fbfb8f97a99a.zip |
enhance collapse_vars (#3602)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 81f24175..abdd9c2a 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -3852,10 +3852,9 @@ issue_2436_9: { expect: { var o = console; console.log({ - x: (c = o).a, - y: c.b, + x: o.a, + y: o.b, }); - var c; } expect_stdout: true } @@ -6567,3 +6566,29 @@ issue_3596: { } expect_stdout: "42" } + +local_value_replacement: { + options = { + collapse_vars: true, + unused: true, + } + input: { + function f(a, b) { + (a = b) && g(a); + } + function g(c) { + console.log(c); + } + f("FAIL", "PASS"); + } + expect: { + function f(a, b) { + (a = b) && g(a); + } + function g(c) { + console.log(c); + } + f("FAIL", "PASS"); + } + expect_stdout: "PASS" +} |