diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-03-23 07:27:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-23 07:27:35 +0800 |
commit | 12985d86c2a7ae66adaf4a08fe44ac3be1f6ef14 (patch) | |
tree | 5d4a1db1945a58a119a16ed08474d6c6d5251bf3 /test/compress | |
parent | 49bfc6b555ca3be3084c0819391eabf2839e6f1b (diff) | |
download | tracifyjs-12985d86c2a7ae66adaf4a08fe44ac3be1f6ef14.tar.gz tracifyjs-12985d86c2a7ae66adaf4a08fe44ac3be1f6ef14.zip |
fix corner case in `hoist_props` (#3022)
fixes #3021
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/hoist_props.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/hoist_props.js b/test/compress/hoist_props.js index 26887af2..90a7f1d8 100644 --- a/test/compress/hoist_props.js +++ b/test/compress/hoist_props.js @@ -686,3 +686,33 @@ undefined_key: { } expect_stdout: "3" } + +issue_3021: { + options = { + hoist_props: true, + reduce_vars: true, + } + input: { + var a = 1, b = 2; + (function() { + b = a; + if (a++ + b--) + return 1; + return; + var b = {}; + })(); + console.log(a, b); + } + expect: { + var a = 1, b = 2; + (function() { + b = a; + if (a++ + b--) + return 1; + return; + var b = {}; + })(); + console.log(a, b); + } + expect_stdout: "2 2" +} |