From: Alex Lam S.L Date: Mon, 7 Dec 2020 05:23:53 +0000 (+0000) Subject: fix corner case in `unused` (#4338) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6b603e1a62efe324af67ed6627b50565aed9599c;p=UglifyJS.git fix corner case in `unused` (#4338) fixes #4337 --- diff --git a/lib/compress.js b/lib/compress.js index 005768b7..09b27635 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -6269,6 +6269,7 @@ merge(Compressor.prototype, { } return this; }); + def(AST_AsyncFunction, return_null); def(AST_Binary, function(compressor, first_in_statement) { if (this.operator == "in" && !is_object(this.right)) { var left = this.left.drop_side_effect_free(compressor, first_in_statement); diff --git a/test/compress/async.js b/test/compress/async.js index 8da545bd..0f997332 100644 --- a/test/compress/async.js +++ b/test/compress/async.js @@ -264,3 +264,26 @@ issue_4335_2: { expect_stdout: "PASS" node_version: ">=8" } + +issue_4337: { + options = { + reduce_vars: true, + unused: true, + } + input: { + (function(a) { + a(); + })(async function() { + console.log("PASS"); + }); + } + expect: { + (function(a) { + (async function() { + console.log("PASS"); + })(); + })(); + } + expect_stdout: "PASS" + node_version: ">=8" +}