aboutsummaryrefslogtreecommitdiff
path: root/test/compress/join_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-05-08 04:49:17 +0100
committerGitHub <noreply@github.com>2020-05-08 11:49:17 +0800
commit7a033bb825975a6a729813b2cbe5a722a9047456 (patch)
tree9a8b20e93b2913b625e6062c5d0524b8c9d56203 /test/compress/join_vars.js
parenta441b009517125fa2e0cdf10150c6fd77bbb54ae (diff)
downloadtracifyjs-7a033bb825975a6a729813b2cbe5a722a9047456.tar.gz
tracifyjs-7a033bb825975a6a729813b2cbe5a722a9047456.zip
fix corner case in `join_vars` (#3857)
fixes #3856
Diffstat (limited to 'test/compress/join_vars.js')
-rw-r--r--test/compress/join_vars.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/join_vars.js b/test/compress/join_vars.js
index a4e0936d..3e4334cf 100644
--- a/test/compress/join_vars.js
+++ b/test/compress/join_vars.js
@@ -989,3 +989,37 @@ conditional_assignments_3: {
}
expect_stdout: "PASS"
}
+
+issue_3856: {
+ options = {
+ booleans: true,
+ conditionals: true,
+ if_return: true,
+ join_vars: true,
+ sequences: true,
+ }
+ input: {
+ console.log(function() {
+ (function() {
+ var a;
+ if (!a) {
+ a = 0;
+ for (var b; !console;);
+ return 0;
+ }
+ if (a) return 1;
+ })();
+ }());
+ }
+ expect: {
+ console.log(function() {
+ (function() {
+ var a, b;
+ if (a) return !!a;
+ for (a = 0; !console;);
+ return 0;
+ })();
+ }());
+ }
+ expect_stdout: "undefined"
+}