aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-20 03:13:15 +0000
committerGitHub <noreply@github.com>2021-02-20 11:13:15 +0800
commit8d668c2963c4322fea47009b057791c1a7caa612 (patch)
tree44d746bffd43a8cee09d060f3d08f3432ae4a272 /test/compress
parent5f60c1b830fec648974b3ea7cbd6f53a6bfd7c75 (diff)
downloadtracifyjs-8d668c2963c4322fea47009b057791c1a7caa612.tar.gz
tracifyjs-8d668c2963c4322fea47009b057791c1a7caa612.zip
fix corner case in `conditionals` & `side_effects` (#4669)
fixes #4668
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/side_effects.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js
index 177cf503..994e884c 100644
--- a/test/compress/side_effects.js
+++ b/test/compress/side_effects.js
@@ -506,3 +506,34 @@ issue_4366_2: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4668: {
+ options = {
+ conditionals: true,
+ keep_fargs: false,
+ keep_fnames: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ var b, c;
+ function g() {
+ return a = 0 + a, !d || (a = 0);
+ }
+ c = g();
+ }
+ console.log(f());
+ var d = 0;
+ }
+ expect: {
+ console.log(function f() {
+ (function g() {
+ 0;
+ })();
+ }());
+ }
+ expect_stdout: "undefined"
+}