Skip to content

Commit

Permalink
fix corner case in inline (#4596)
Browse files Browse the repository at this point in the history
fixes #4595
  • Loading branch information
alexlamsl authored Jan 26, 2021
1 parent 4723b45 commit d0bb147
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions test/compress/awaits.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit d0bb147

Please sign in to comment.