aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-11-05 04:27:01 +0800
committerGitHub <noreply@github.com>2017-11-05 04:27:01 +0800
commita8aa28a7a6c0cb415965d055119956d4333de8fa (patch)
tree7961dfe4da68bf9407d14bcf6cd418d5b58c2b09 /test/compress/reduce_vars.js
parentfe5a68f9d5a93557d44c48cd0a8ee533e2bd1a47 (diff)
downloadtracifyjs-a8aa28a7a6c0cb415965d055119956d4333de8fa.tar.gz
tracifyjs-a8aa28a7a6c0cb415965d055119956d4333de8fa.zip
consolidate single-use `function` reduction (#2427)
fixes #2423
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index e4d22e9b..a18d4256 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -3379,3 +3379,75 @@ issue_2420_2: {
"false false true",
]
}
+
+issue_2423_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function c() { return 1; }
+ function p() { console.log(c()); }
+ p();
+ p();
+ }
+ expect: {
+ function p() { console.log(function() { return 1; }()); }
+ p();
+ p();
+ }
+}
+
+issue_2423_2: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function c() { return 1; }
+ function p() { console.log(c()); }
+ p();
+ p();
+ }
+ expect: {
+ function p() { console.log(1); }
+ p();
+ p();
+ }
+}
+
+issue_2423_3: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function c() { return 1; }
+ function p() { console.log(c()); }
+ p();
+ }
+ expect: {
+ (function() { console.log(function() { return 1; }()); })();
+ }
+}
+
+issue_2423_4: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function c() { return 1; }
+ function p() { console.log(c()); }
+ p();
+ }
+ expect: {
+ void console.log(1);
+ }
+}