aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-12 17:08:16 +0000
committerGitHub <noreply@github.com>2021-01-13 01:08:16 +0800
commitfc816628c12f832ec5d6c3158f1c28938077b098 (patch)
treebb22e9966296b89b752372b36eb3266be7c9d2c9 /test/compress
parent46ad273df49b2e320c6ee01f167fb3f9b8242213 (diff)
downloadtracifyjs-fc816628c12f832ec5d6c3158f1c28938077b098.tar.gz
tracifyjs-fc816628c12f832ec5d6c3158f1c28938077b098.zip
fix corner case in `side_effects` (#4545)
fixes #4544
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/rests.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/rests.js b/test/compress/rests.js
index ed927700..6bc5b756 100644
--- a/test/compress/rests.js
+++ b/test/compress/rests.js
@@ -600,3 +600,49 @@ issue_4538: {
expect_stdout: "function"
node_version: ">=6"
}
+
+issue_4544_1: {
+ options = {
+ keep_fnames: true,
+ side_effects: true,
+ }
+ input: {
+ try {
+ (function f(...[ {} ]) {})();
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ try {
+ [ ...[ {} ] ] = [];
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4544_2: {
+ options = {
+ keep_fnames: true,
+ side_effects: true,
+ }
+ input: {
+ try {
+ (function f(a, ...[ {} ]) {})([]);
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ try {
+ [ , ...[ {} ] ] = [ [] ];
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}