aboutsummaryrefslogtreecommitdiff
path: root/test/compress/destructured.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-17 10:03:31 +0000
committerGitHub <noreply@github.com>2020-11-17 18:03:31 +0800
commit383163afa67c5726e18da145d6eb012ee1b064e3 (patch)
tree67a17555d89272b845e5ff291a42a666e87a14dc /test/compress/destructured.js
parent8a83c8dd46dc8e446cd7231116a06c8b217291b7 (diff)
downloadtracifyjs-383163afa67c5726e18da145d6eb012ee1b064e3.tar.gz
tracifyjs-383163afa67c5726e18da145d6eb012ee1b064e3.zip
fix corner case in `collapse_vars` (#4287)
fixes #4286
Diffstat (limited to 'test/compress/destructured.js')
-rw-r--r--test/compress/destructured.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 1555e3e3..6feb5bd6 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -1403,3 +1403,40 @@ issue_4284_3: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4286_1: {
+ options = {
+ collapse_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = "PASS", b;
+ (0 && a)[{ a } = b = a];
+ console.log(b);
+ }
+ expect: {
+ var a = "PASS", b;
+ (0 && a)[{ a } = b = a];
+ console.log(b);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4286_2: {
+ options = {
+ collapse_vars: true,
+ toplevel: true,
+ }
+ input: {
+ a = [ "PASS" ];
+ var b, { a } = b = a;
+ console.log(b[0]);
+ }
+ expect: {
+ var b, { a } = b = a = [ "PASS" ];
+ console.log(b[0]);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}