aboutsummaryrefslogtreecommitdiff
path: root/test/compress/const.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-12 18:30:21 +0100
committerGitHub <noreply@github.com>2020-10-13 01:30:21 +0800
commit9272f662c0c89387a2bc9e7a47024ccc9d0c09a4 (patch)
tree48ea465829e6e45465df6fcf7edc6caed724c87a /test/compress/const.js
parent4d33cb2f94d2a9326c67032836f8fa3d4c0731f8 (diff)
downloadtracifyjs-9272f662c0c89387a2bc9e7a47024ccc9d0c09a4.tar.gz
tracifyjs-9272f662c0c89387a2bc9e7a47024ccc9d0c09a4.zip
fix corner case in `collapse_vars` (#4206)
fixes #4205
Diffstat (limited to 'test/compress/const.js')
-rw-r--r--test/compress/const.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/const.js b/test/compress/const.js
index 28dda019..d1164cc1 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -872,3 +872,40 @@ issue_4202: {
}
expect_stdout: "42"
}
+
+issue_4205: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = function(b) {
+ var c = function() {
+ switch (0) {
+ case a:
+ return 0;
+ case b:
+ case console.log("PASS"):
+ }
+ }();
+ {
+ const b = c;
+ }
+ }();
+ }
+ expect: {
+ var a = function(b) {
+ var c = function() {
+ switch (0) {
+ case a:
+ return 0;
+ case b:
+ case console.log("PASS"):
+ }
+ }();
+ {
+ const b = c;
+ }
+ }();
+ }
+ expect_stdout: true
+}