aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-01 17:01:00 +0000
committerGitHub <noreply@github.com>2020-11-02 01:01:00 +0800
commite7643248a314244caeae8464ae5b713ede5b2e3d (patch)
tree13efca8e3107c70d0ec65aa2d850fbce0556327b /test
parent68091dbf699bc575f73d60fd202c6da3eae4b272 (diff)
downloadtracifyjs-e7643248a314244caeae8464ae5b713ede5b2e3d.tar.gz
tracifyjs-e7643248a314244caeae8464ae5b713ede5b2e3d.zip
fix corner case in `merge_vars` (#4258)
fixes #4257
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 ec0410fa..1841e3db 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -3146,3 +3146,40 @@ issue_4255: {
}
expect_stdout: "0"
}
+
+issue_4257: {
+ options = {
+ merge_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = 0;
+ for (var i = 0; i < 2; i++)
+ switch (--a) {
+ case 0:
+ var b = 0;
+ break;
+ case 0:
+ default:
+ var c = 1 + (0 | (b && A));
+ console.log(c);
+ }
+ }
+ expect: {
+ var a = 0;
+ for (var i = 0; i < 2; i++)
+ switch (--a) {
+ case 0:
+ var b = 0;
+ break;
+ case 0:
+ default:
+ var c = 1 + (0 | (b && A));
+ console.log(c);
+ }
+ }
+ expect_stdout: [
+ "1",
+ "1",
+ ]
+}