aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-24 06:33:48 +0100
committerGitHub <noreply@github.com>2020-10-24 13:33:48 +0800
commitc5df8355ba00fdf5ffa81192e0d88cf0dca90061 (patch)
treeaf48bda48ba5fd71857ec9d28d1e08f3bd78d40f /test
parentff38d2471f36815f3d56774092a8d298719fd4fb (diff)
downloadtracifyjs-c5df8355ba00fdf5ffa81192e0d88cf0dca90061.tar.gz
tracifyjs-c5df8355ba00fdf5ffa81192e0d88cf0dca90061.zip
fix corner case in `loops` & `unused` (#4241)
fixes #4240
Diffstat (limited to 'test')
-rw-r--r--test/compress/loops.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js
index cfabe6fd..69150820 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -1222,3 +1222,35 @@ do_continue: {
}
expect_stdout: "PASS"
}
+
+issue_4240: {
+ options = {
+ loops: true,
+ reduce_funcs: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function(a) {
+ function f() {
+ var o = { PASS: 42 };
+ for (a in o);
+ }
+ (function() {
+ if (f());
+ })();
+ console.log(a);
+ })();
+ }
+ expect: {
+ (function(a) {
+ (function() {
+ if (function() {
+ for (a in { PASS: 42 });
+ }());
+ })();
+ console.log(a);
+ })();
+ }
+ expect_stdout: "PASS"
+}