diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-05-10 01:22:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-10 01:22:44 +0800 |
commit | 5476cb8f05d0e7d402d583ef726e743451555c10 (patch) | |
tree | 41a45da197ce1c52387d7bf738ebed552814751b /test/compress/functions.js | |
parent | 6a30e1d6bed66512d33dbb83adc954b43fe2823e (diff) | |
download | tracifyjs-5476cb8f05d0e7d402d583ef726e743451555c10.tar.gz tracifyjs-5476cb8f05d0e7d402d583ef726e743451555c10.zip |
fix corner case in `inline` (#3401)
fixes #3400
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r-- | test/compress/functions.js | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index e12ce3e2..21146457 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -2860,10 +2860,10 @@ issue_2437: { result; } function detectFunc() {} - var req; - (req = new XMLHttpRequest()).onreadystatechange = detectFunc; - result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc; - return req.onreadystatechange = null, result; + var req = new XMLHttpRequest(); + return req.onreadystatechange = detectFunc, + result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc, + req.onreadystatechange = null, result; }()); } } @@ -3065,3 +3065,51 @@ class_iife: { } expect_stdout: "PASS" } + +issue_3400: { + options = { + collapse_vars: true, + inline: true, + reduce_funcs: true, + reduce_vars: true, + unused: true, + } + input: { + (function(f) { + console.log(f()()[0].p); + })(function() { + function g() { + function h(u) { + var o = { + p: u + }; + return console.log(o[g]), o; + } + function e() { + return [ 42 ].map(function(v) { + return h(v); + }); + } + return e(); + } + return g; + }); + } + expect: { + void console.log(function g() { + function e() { + return [42].map(function(v) { + return o = { + p: v + }, console.log(o[g]) , o; + var o; + }); + } + return e(); + }()[0].p); + } + expect_stdout: [ + "undefined", + "42", + ] +} |