aboutsummaryrefslogtreecommitdiff
path: root/test/compress/async.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-17 22:18:47 +0000
committerGitHub <noreply@github.com>2020-12-18 06:18:47 +0800
commit4fa54b075c4507901fd3750e8fc7834cf7e9c809 (patch)
tree3e9ef13a3c3db1035115d7bf1ddee98577c7b0aa /test/compress/async.js
parentab82be82b28c8fed0643569700d9b5ff2f093aea (diff)
downloadtracifyjs-4fa54b075c4507901fd3750e8fc7834cf7e9c809.tar.gz
tracifyjs-4fa54b075c4507901fd3750e8fc7834cf7e9c809.zip
enhance `reduce_vars` (#4392)
Diffstat (limited to 'test/compress/async.js')
-rw-r--r--test/compress/async.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/compress/async.js b/test/compress/async.js
index 8b7f596e..79189c7d 100644
--- a/test/compress/async.js
+++ b/test/compress/async.js
@@ -329,6 +329,77 @@ property_access_expression: {
node_version: ">=8"
}
+reduce_iife_1: {
+ options = {
+ evaluate: true,
+ keep_fargs: "strict",
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (async function(a) {
+ console.log(a + a);
+ })(21);
+ }
+ expect: {
+ (async function() {
+ console.log(42);
+ })();
+ }
+ expect_stdout: "42"
+ node_version: ">=8"
+}
+
+reduce_iife_2: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = 21;
+ (async function() {
+ console.log(a + a);
+ })();
+ }
+ expect: {
+ (async function() {
+ console.log(42);
+ })();
+ }
+ expect_stdout: "42"
+ node_version: ">=8"
+}
+
+reduce_iife_3: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = "foo";
+ (async function() {
+ console.log(a);
+ console.log(await a);
+ })();
+ a = "bar";
+ }
+ expect: {
+ var a = "foo";
+ (async function() {
+ console.log(a);
+ console.log(await a);
+ })();
+ a = "bar";
+ }
+ expect_stdout: "foo"
+ node_version: ">=8"
+}
+
issue_4347_1: {
options = {
evaluate: true,