aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-20 16:54:14 +0100
committerGitHub <noreply@github.com>2020-09-20 23:54:14 +0800
commit8fa470c17c56d62f971fa71fb1cb99e961b64d8e (patch)
treee0e319a5219509ea75507f8162aa260935c2ddcd /test
parent90410f9fc3538a5f267c38470490b83086d71b85 (diff)
downloadtracifyjs-8fa470c17c56d62f971fa71fb1cb99e961b64d8e.tar.gz
tracifyjs-8fa470c17c56d62f971fa71fb1cb99e961b64d8e.zip
fix corner case in `merge_vars` (#4136)
fixes #4135
Diffstat (limited to 'test')
-rw-r--r--test/compress/merge_vars.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js
index d48b1178..b5b71019 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -2701,3 +2701,40 @@ issue_4130: {
"1",
]
}
+
+issue_4135: {
+ options = {
+ evaluate: true,
+ inline: true,
+ merge_vars: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = 0, b = 0;
+ --b;
+ a++;
+ if (!a)
+ var c = function() {
+ var d = 0;
+ function f() {
+ d && d.p;
+ }
+ f();
+ this;
+ }(a++);
+ console.log(a, b, c);
+ }
+ expect: {
+ var a = 0;
+ 0;
+ a++;
+ if (!a)
+ c = (a++, c = 0, void (c && c.p));
+ var c;
+ console.log(a, -1, c);
+ }
+ expect_stdout: "1 -1 undefined"
+}