aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-01 06:34:07 +0000
committerGitHub <noreply@github.com>2020-11-01 14:34:07 +0800
commit68091dbf699bc575f73d60fd202c6da3eae4b272 (patch)
treeb4fd4f197ea943b978795a8ece274bf629fdc830 /test/compress
parentcbf7269296896bdaf7cc29ec20e41434b5e6365a (diff)
downloadtracifyjs-68091dbf699bc575f73d60fd202c6da3eae4b272.tar.gz
tracifyjs-68091dbf699bc575f73d60fd202c6da3eae4b272.zip
fix corner case in `merge_vars` (#4256)
fixes #4255
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/merge_vars.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js
index b61b486d..ec0410fa 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -3124,3 +3124,25 @@ issue_4253: {
}
expect_stdout: "undefined"
}
+
+issue_4255: {
+ options = {
+ dead_code: true,
+ loops: true,
+ merge_vars: true,
+ toplevel: true,
+ }
+ input: {
+ L: for (var a = 2; --a;)
+ for (var b = 0; console.log(b); --b)
+ break L;
+ }
+ expect: {
+ L: for (var a = 2; --a;) {
+ var b = 0;
+ if (console.log(b))
+ break L;
+ }
+ }
+ expect_stdout: "0"
+}