Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(es/typescript): Remove empty statements that const enum decls are folded into #10128

Merged
merged 19 commits into from
Mar 1, 2025

Conversation

CPunisher
Copy link
Member

@CPunisher CPunisher commented Mar 1, 2025

closes #10097

By searching asEmbeddedStatement in https://github.com/microsoft/TypeScript/blob/main/src/compiler/factory/nodeFactory.ts, we can know there are four cases where typescript doesn't insert an empty statement:

  1. Stmt in ModuleItem
  2. Stmts in Script's body
  3. Stmts in BlockStmt
  4. Stmts in SwitchCase

Case 2, 3, 4 can be merged in visit_mut_stmts, while case 1 should be handled in visit_mut_module_items

@CPunisher CPunisher requested a review from a team as a code owner March 1, 2025 06:31
Copy link

changeset-bot bot commented Mar 1, 2025

🦋 Changeset detected

Latest commit: 6fa7994

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

@CPunisher CPunisher requested a review from magic-akari March 1, 2025 06:31
magic-akari
magic-akari previously approved these changes Mar 1, 2025
Copy link

codspeed-hq bot commented Mar 1, 2025

CodSpeed Performance Report

Merging #10128 will degrade performances by 3.69%

Comparing CPunisher:03-01-fix/enum-statement (4636899) with main (edea2c5)

Summary

❌ 1 regressions
✅ 190 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
es/full/minify/libraries/lodash 182.1 ms 189.1 ms -3.69%

@kdy1 kdy1 added this to the Planned milestone Mar 1, 2025
@kdy1 kdy1 requested a review from a team as a code owner March 1, 2025 11:05
@kdy1 kdy1 enabled auto-merge (squash) March 1, 2025 11:07
@kdy1
Copy link
Member

kdy1 commented Mar 1, 2025

I discarded the changes of stack traces because CI failed

@kdy1 kdy1 merged commit 7bea830 into swc-project:main Mar 1, 2025
171 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.11.6 Mar 4, 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.

const enum transpiles to empty statement
3 participants