fix corner case in inline (#4596)

fixes #4595
This commit is contained in:
Alex Lam S.L
2021-01-26 17:30:05 +00:00
committed by GitHub
parent 4723b4541e
commit d0bb147639
2 changed files with 24 additions and 1 deletions

View File

@@ -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

View File

@@ -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"
}