aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-01 22:38:19 +0800
committerGitHub <noreply@github.com>2019-11-01 22:38:19 +0800
commit24bb2888328a4fb01b7cfb49695b0f84e7120aeb (patch)
tree2e2fc6516ed4e3a2632f16e71844d96f2681ae86 /test/compress/collapse_vars.js
parent6ad8e1081f4becc51d1a3a946b3851069918aca8 (diff)
downloadtracifyjs-24bb2888328a4fb01b7cfb49695b0f84e7120aeb.tar.gz
tracifyjs-24bb2888328a4fb01b7cfb49695b0f84e7120aeb.zip
fix corner case in `collapse_vars` (#3563)
fixes #3562
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 858d3d41..31978c29 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -6348,3 +6348,42 @@ issue_3526_2: {
}
expect_stdout: "PASS"
}
+
+issue_3562: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ sequences: true,
+ }
+ input: {
+ function f(a) {
+ console.log("PASS", a);
+ }
+ function g(b) {
+ console.log("FAIL", b);
+ }
+ var h;
+ var c;
+ if (console) {
+ h = f;
+ c = "PASS";
+ } else {
+ h = g;
+ c = "FAIL";
+ }
+ h(c);
+ }
+ expect: {
+ function f(a) {
+ console.log("PASS", a);
+ }
+ function g(b) {
+ console.log("FAIL", b);
+ }
+ var h;
+ var c;
+ c = console ? (h = f, "PASS") : (h = g, "FAIL"),
+ h(c);
+ }
+ expect_stdout: "PASS PASS"
+}