aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-25 14:50:11 +0000
committerGitHub <noreply@github.com>2020-12-25 22:50:11 +0800
commit95aea0e33ce0288d7c31b11b044432f2043cf3d1 (patch)
treee178048a72cef9e15236f53c7791288d263a0e2e /test/compress
parenta1b2735dd8f7f89b7dd57ee7098f1720df28838f (diff)
downloadtracifyjs-95aea0e33ce0288d7c31b11b044432f2043cf3d1.tar.gz
tracifyjs-95aea0e33ce0288d7c31b11b044432f2043cf3d1.zip
fix corner case in `reduce_vars` (#4459)
fixes #4458
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/default-values.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index bda32c1b..eefa6e0e 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -1076,3 +1076,27 @@ issue_4446_2: {
expect_stdout: "PASS 42"
node_version: ">=6"
}
+
+issue_4458: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = "PASS";
+ function f(b = a = "FAIL") {
+ console.log(a, b);
+ }
+ f(42);
+ }
+ expect: {
+ var a = "PASS";
+ (function(b = a = "FAIL") {
+ console.log(a, b);
+ })(42);
+ }
+ expect_stdout: "PASS 42"
+ node_version: ">=6"
+}