aboutsummaryrefslogtreecommitdiff
path: root/test/compress/destructured.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-05-27 23:32:43 +0100
committerGitHub <noreply@github.com>2021-05-28 06:32:43 +0800
commit749a828fc5995836596f1d554f31479d533232fe (patch)
treec84aabd9f2200eb92713132e37d3e8d4d63b8f2f /test/compress/destructured.js
parentab42a90edb0316d7c5ed1a74b4a7f9167789ce4d (diff)
downloadtracifyjs-749a828fc5995836596f1d554f31479d533232fe.tar.gz
tracifyjs-749a828fc5995836596f1d554f31479d533232fe.zip
fix corner case in `collapse_vars` (#4970)
Diffstat (limited to 'test/compress/destructured.js')
-rw-r--r--test/compress/destructured.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index dd2daca9..78cd6863 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -1010,6 +1010,42 @@ collapse_vars_8: {
node_version: ">=6"
}
+collapse_vars_9: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ console.log(function(a) {
+ try {
+ var b = function([ c ]) {
+ if (c)
+ return "FAIL 1";
+ }();
+ a = "FAIL 2";
+ return b;
+ } catch (e) {
+ return a;
+ }
+ }("PASS"));
+ }
+ expect: {
+ console.log(function(a) {
+ try {
+ var b = function([ c ]) {
+ if (c)
+ return "FAIL 1";
+ }();
+ a = "FAIL 2";
+ return b;
+ } catch (e) {
+ return a;
+ }
+ }("PASS"));
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
conditionals: {
options = {
conditionals: true,