aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-05-10 00:16:09 +0100
committerGitHub <noreply@github.com>2020-05-10 07:16:09 +0800
commitabb8ae02a55b3e3585685362cbae99c6b7a9a380 (patch)
tree00ce03a98027af4248cf0dbd763186584b398e6b /test
parent97728c4f0bb3a9fe3f135371deaa94afaad7921c (diff)
downloadtracifyjs-abb8ae02a55b3e3585685362cbae99c6b7a9a380.tar.gz
tracifyjs-abb8ae02a55b3e3585685362cbae99c6b7a9a380.zip
improve `inline` of `/*@__PURE__*/` calls (#3865)
Diffstat (limited to 'test')
-rw-r--r--test/compress/pure_funcs.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/compress/pure_funcs.js b/test/compress/pure_funcs.js
index 2ca21d00..15ddf095 100644
--- a/test/compress/pure_funcs.js
+++ b/test/compress/pure_funcs.js
@@ -706,3 +706,79 @@ issue_3858: {
}
expect_stdout: "PASS"
}
+
+inline_pure_call_1: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ keep_fargs: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var f = function(a) {
+ return /*@__PURE__*/ function(b) {
+ console.log(b);
+ }(a);
+ };
+ f("PASS");
+ }
+ expect: {}
+}
+
+inline_pure_call_2: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ keep_fargs: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var f = function(a) {
+ return /*@__PURE__*/ function(b) {
+ console.log(b);
+ }(a);
+ };
+ var a = f("PASS");
+ }
+ expect: {}
+}
+
+inline_pure_call_3: {
+ options = {
+ collapse_vars: true,
+ evaluate: true,
+ inline: true,
+ keep_fargs: "strict",
+ passes: 2,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var f = function(a) {
+ return /*@__PURE__*/ function(b) {
+ console.log(b);
+ }(a);
+ };
+ var a = f("PASS");
+ console.log(a);
+ }
+ expect: {
+ var a = function() {
+ console.log("PASS");
+ }();
+ console.log(a);
+ }
+ expect_stdout: [
+ "PASS",
+ "undefined",
+ ]
+}