aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js2
-rw-r--r--test/compress/awaits.js23
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index ac380cf3..a662b991 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -8270,7 +8270,7 @@ merge(Compressor.prototype, {
if (can_inline
&& !fn.uses_arguments
&& !fn.pinned()
- && !(fn.name && fn instanceof AST_Function)
+ && !(fn.name && is_function(fn))
&& (exp === fn || !recursive_ref(compressor, def = exp.definition())
&& fn.is_constant_expression(find_scope(compressor)))
&& !has_spread
diff --git a/test/compress/awaits.js b/test/compress/awaits.js
index 0ffa1a9b..01a55710 100644
--- a/test/compress/awaits.js
+++ b/test/compress/awaits.js
@@ -1024,3 +1024,26 @@ issue_4581: {
expect_stdout: "PASS"
node_version: ">=8"
}
+
+issue_4595: {
+ options = {
+ awaits: true,
+ inline: true,
+ }
+ input: {
+ (async function() {
+ await async function f() {
+ console.log(f.length);
+ }();
+ })();
+ }
+ expect: {
+ (async function() {
+ await async function f() {
+ console.log(f.length);
+ }();
+ })();
+ }
+ expect_stdout: "0"
+ node_version: ">=8"
+}