aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-05-01 20:57:17 +0100
committerGitHub <noreply@github.com>2021-05-02 03:57:17 +0800
commit6ab26eef6c4bb67200f0b8b65171f774f1a16377 (patch)
treeb3172461b899eae5765b639a1a9b2f7d64edb97c /test/compress
parent53b57ee57e3d00792f70685e6b4531e6d990ca27 (diff)
downloadtracifyjs-6ab26eef6c4bb67200f0b8b65171f774f1a16377.tar.gz
tracifyjs-6ab26eef6c4bb67200f0b8b65171f774f1a16377.zip
fix corner case in `collapse_vars` (#4892)
fixes #4891
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/collapse_vars.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 449ce3d5..3ac8894a 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -9057,3 +9057,31 @@ issue_4874: {
}
expect_stdout: "PASS"
}
+
+issue_4891: {
+ options = {
+ collapse_vars: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = 0, b;
+ a++;
+ console.log(b = a, b);
+ b--;
+ a.a += 0;
+ console.log(b);
+ }
+ expect: {
+ var a = 0, b;
+ a++;
+ console.log(a, b = a);
+ b--;
+ a.a += 0;
+ console.log(b);
+ }
+ expect_stdout: [
+ "1 1",
+ "0",
+ ]
+}