diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-09-25 01:04:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 08:04:51 +0800 |
commit | af35cd32f28dfc3f79380d8f1b8294fc550d07e2 (patch) | |
tree | ca1811b7c045e0b3f600f363ab3c012eab6b481b /test | |
parent | 7de8daa4b151fc47080d5a5f6329c3f80b9a5e7d (diff) | |
download | tracifyjs-af35cd32f28dfc3f79380d8f1b8294fc550d07e2.tar.gz tracifyjs-af35cd32f28dfc3f79380d8f1b8294fc550d07e2.zip |
fix corner case in `merge_vars` (#4151)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/merge_vars.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js index 559832c2..b5148669 100644 --- a/test/compress/merge_vars.js +++ b/test/compress/merge_vars.js @@ -2766,3 +2766,37 @@ issue_4139: { } expect_stdout: "object" } + +lambda_reuse: { + options = { + merge_vars: true, + toplevel: true, + } + input: { + var a, b, f = function() { + console.log(a); + }; + f(); + a = "PASS"; + b = "FAIL"; + f(); + if (console.log(typeof b)) + console.log(b); + } + expect: { + var a, b, f = function() { + console.log(a); + }; + f(); + a = "PASS"; + b = "FAIL"; + f(); + if (console.log(typeof b)) + console.log(b); + } + expect_stdout: [ + "undefined", + "PASS", + "string", + ] +} |