aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-07-24 00:10:14 +0100
committerGitHub <noreply@github.com>2021-07-24 07:10:14 +0800
commit657d525c80e611df9a78812e4b6a35a3eb24d8f4 (patch)
tree011d38b8dc62992972f61270915e62fece469e7c /test
parent6a3fe9d1dfd3ec4543dc71b72e990bed2c6022ef (diff)
downloadtracifyjs-657d525c80e611df9a78812e4b6a35a3eb24d8f4.tar.gz
tracifyjs-657d525c80e611df9a78812e4b6a35a3eb24d8f4.zip
fix corner case in `reduce_vars` (#5099)
fixes #5098
Diffstat (limited to 'test')
-rw-r--r--test/compress/functions.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index ff727da4..ccfb3044 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -6535,3 +6535,33 @@ issue_5096_4: {
}
expect_stdout: "PASS"
}
+
+issue_5098: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function(o) {
+ function f() {
+ f = console.log;
+ if (o.p++)
+ throw "FAIL";
+ f("PASS");
+ }
+ return f;
+ })({ p: 0 })();
+ }
+ expect: {
+ (function(o) {
+ function f() {
+ f = console.log;
+ if (o.p++)
+ throw "FAIL";
+ f("PASS");
+ }
+ return f;
+ })({ p: 0 })();
+ }
+ expect_stdout: "PASS"
+}