aboutsummaryrefslogtreecommitdiff
path: root/test/compress/destructured.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-06-21 04:12:45 +0100
committerGitHub <noreply@github.com>2021-06-21 11:12:45 +0800
commit111366fca0352df45459ee8dc3fa6d8dcc337d92 (patch)
tree34603730576e5d1f7ffbb84404c44a7d397228e0 /test/compress/destructured.js
parente368d3971588c78413a91d89c23356d2f511c723 (diff)
downloadtracifyjs-111366fca0352df45459ee8dc3fa6d8dcc337d92.tar.gz
tracifyjs-111366fca0352df45459ee8dc3fa6d8dcc337d92.zip
fix corner case in `collapse_vars` (#5018)
fixes #5017
Diffstat (limited to 'test/compress/destructured.js')
-rw-r--r--test/compress/destructured.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 41e337be..140d48e1 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -2625,3 +2625,25 @@ issue_4994: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_5017: {
+ options = {
+ collapse_vars: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = function() {};
+ var b = c = a;
+ var c = [ c ] = [ c ];
+ console.log(c[0] === a ? "PASS" : "FAIL");
+ }
+ expect: {
+ var a = function() {};
+ var b = a;
+ var c = [ c ] = [ c = a ];
+ console.log(c[0] === a ? "PASS" : "FAIL");
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}