aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ast.js2
-rw-r--r--test/compress/pure_funcs.js76
2 files changed, 77 insertions, 1 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 240ef160..31072a08 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -745,7 +745,7 @@ function must_be_expressions(node, prop) {
});
}
-var AST_Call = DEFNODE("Call", "expression args", {
+var AST_Call = DEFNODE("Call", "expression args pure", {
$documentation: "A function call expression",
$propdoc: {
expression: "[AST_Node] expression to invoke as function",
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",
+ ]
+}