Skip to content

Conversation

@Austaras
Copy link
Member

Description:

BREAKING CHANGE:

Related issue (if exists):

@Copilot Copilot AI review requested due to automatic review settings October 21, 2025 09:09
@Austaras Austaras requested a review from a team as a code owner October 21, 2025 09:09
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2025

🦋 Changeset detected

Latest commit: 00c7991

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the JavaScript minifier's inlining logic for hoisted functions used within parameter initializers. The issue prevented proper inlining when a hoisted function was called indirectly through another function (e.g., gen() calling foo(12)).

Key Changes:

  • Replaced manual pattern matching for identifying dependent identifiers with a call to collect_infects_from() to comprehensively detect all referenced identifiers in initialization expressions
  • Updated test expectations to reflect the corrected minification behavior where foo(12) is now properly inlined to 12

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/swc_ecma_minifier/src/compress/optimize/inline.rs Refactored identifier collection logic to use collect_infects_from() for more comprehensive detection of dependencies
crates/swc_ecma_minifier/tests/fixture/issues/11158/input.js Added test case demonstrating hoisted function inlining through indirect calls
crates/swc_ecma_minifier/tests/fixture/issues/11158/output.js Updated expected output showing correct inlining of foo(12) to 12 in the minified code

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 21, 2025

CodSpeed Performance Report

Merging #11161 will not alter performance

Comparing Austaras:main (00c7991) with main (bd55d30)1

Summary

✅ 140 untouched

Footnotes

  1. No successful run was found on main (4848301) during the generation of this report, so bd55d30 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@kdy1 kdy1 changed the title fix(es/minifier): fix inlining of hoisted functions in param fix(es/minifier): Fix inlining of hoisted functions in param Oct 22, 2025
kdy1
kdy1 previously approved these changes Oct 22, 2025
@kdy1 kdy1 requested a review from a team as a code owner October 22, 2025 10:25
@kdy1 kdy1 merged commit 5a4088d into swc-project:main Oct 22, 2025
21 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.13.21 Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants