aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-07-19 15:35:45 +0100
committerGitHub <noreply@github.com>2021-07-19 22:35:45 +0800
commit85968dee5453dfb3cc0cb5c67f363eccd58b08c6 (patch)
treec54fe62d6d20e10a55b0454e3616a608143dfde3 /test
parenta7e7865e6bb446d7bcb26fa96d57041c65001d01 (diff)
downloadtracifyjs-85968dee5453dfb3cc0cb5c67f363eccd58b08c6.tar.gz
tracifyjs-85968dee5453dfb3cc0cb5c67f363eccd58b08c6.zip
fix corner case in `inline` (#5088)
fixes #5087
Diffstat (limited to 'test')
-rw-r--r--test/compress/destructured.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 4ba32f3e..879e9529 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -2998,3 +2998,62 @@ issue_5085_2: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_5087_1: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ properties: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a = "PASS";
+ (function() {
+ (function() {
+ (function([ b ]) {
+ b && console.log(b);
+ })([ a ]);
+ })();
+ })();
+ }
+ expect: {
+ var a = "PASS";
+ (function() {
+ var b;
+ (b = a) && console.log(b);
+ })();
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_5087_2: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ passes: 2,
+ properties: true,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a = "PASS";
+ (function() {
+ (function() {
+ (function([ b ]) {
+ b && console.log(b);
+ })([ a ]);
+ })();
+ })();
+ }
+ expect: {
+ var a = "PASS";
+ a && console.log(a);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}