Skip to content

Commit

Permalink
fix(es/minifier): Abort seq inline on recursive usage (#8887)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #8841
  • Loading branch information
Austaras authored Apr 23, 2024
1 parent 839bbfd commit cd4548f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ impl Optimizer<'_> {
can_take_init = true;
}

if usage.inline_prevented {
if usage.inline_prevented || usage.used_recursively {
return Ok(false);
}

Expand Down
4 changes: 4 additions & 0 deletions crates/swc_ecma_minifier/tests/fixture/issues/8841/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const k = (() => {
var x = x;
return x;
})();
2 changes: 2 additions & 0 deletions crates/swc_ecma_minifier/tests/fixture/issues/8841/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var x;
export const k = x;

0 comments on commit cd4548f

Please sign in to comment.