aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-03 18:51:26 +0100
committerGitHub <noreply@github.com>2020-09-04 01:51:26 +0800
commit6e235602fb9d7876150a0abf5c918e28db240f2a (patch)
tree71d74f29f4e6758e2d11fbd897feed312819ee63 /test
parent980fcbb56b674c1c78e1483b6d66a2f49e58d80b (diff)
downloadtracifyjs-6e235602fb9d7876150a0abf5c918e28db240f2a.tar.gz
tracifyjs-6e235602fb9d7876150a0abf5c918e28db240f2a.zip
fix corner case in `loops` & `unused` (#4092)
fixes #4091
Diffstat (limited to 'test')
-rw-r--r--test/compress/loops.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js
index 878b77cb..cbc1166f 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -1037,3 +1037,54 @@ issue_4084: {
}
expect_stdout: "undefined"
}
+
+issue_4091_1: {
+ options = {
+ loops: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ try {
+ throw "FAIL";
+ } catch (e) {
+ for (var e in 42);
+ }
+ console.log(e && e);
+ }
+ expect: {
+ try {
+ throw "FAIL";
+ } catch (e) {
+ var e;
+ }
+ console.log(e && e);
+ }
+ expect_stdout: "undefined"
+}
+
+issue_4091_2: {
+ options = {
+ loops: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ try {
+ throw "FAIL";
+ } catch (e) {
+ for (e in 42);
+ var e;
+ }
+ console.log(e && e);
+ }
+ expect: {
+ try {
+ throw "FAIL";
+ } catch (e) {
+ var e;
+ }
+ console.log(e && e);
+ }
+ expect_stdout: "undefined"
+}