aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-12-29 00:57:59 +0000
committerGitHub <noreply@github.com>2019-12-29 00:57:59 +0000
commit2f3930d1b92746be6a3b3e1d371b0ae25e56777e (patch)
treead51c3dab21a6c88d39fedab202315a9b4942cb4 /test/compress
parentd1a78920d9b85074fd4e9b0d07556a7a266631e8 (diff)
downloadtracifyjs-2f3930d1b92746be6a3b3e1d371b0ae25e56777e.tar.gz
tracifyjs-2f3930d1b92746be6a3b3e1d371b0ae25e56777e.zip
fix corner case in `collapse_vars` (#3652)
fixes #3651
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/collapse_vars.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index edb5d57f..796fdb3f 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -7422,3 +7422,45 @@ issue_3641: {
}
expect_stdout: "foo undefined"
}
+
+issue_3651: {
+ options = {
+ collapse_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a, b = "PASS";
+ try {
+ a = function() {
+ try {
+ var c = 1;
+ while (0 < --c);
+ } catch (e) {} finally {
+ throw 42;
+ }
+ }();
+ b = "FAIL";
+ a.p;
+ } catch (e) {
+ console.log(b);
+ }
+ }
+ expect: {
+ var a, b = "PASS";
+ try {
+ a = function() {
+ try {
+ var c = 1;
+ while (0 < --c);
+ } catch (e) {} finally {
+ throw 42;
+ }
+ }();
+ b = "FAIL";
+ a.p;
+ } catch (e) {
+ console.log(b);
+ }
+ }
+ expect_stdout: "PASS"
+}