Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Oct 5, 2025

fixes #14342

@github-actions github-actions bot added A-minifier Area - Minifier A-codegen Area - Code Generation C-bug Category - Bug labels Oct 5, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sapphi-red sapphi-red requested a review from Boshen October 5, 2025 17:19
@sapphi-red sapphi-red marked this pull request as ready for review October 5, 2025 17:20
Copilot AI review requested due to automatic review settings October 5, 2025 17:20
Copy link
Contributor

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 private class member mangling in subsequent classes by changing from a linear Vec-based approach to using IndexVec with ClassId for proper class tracking during code generation.

  • Replaces Vec with IndexVec<ClassId, FxHashMap> for class private member mappings
  • Updates the class tracking mechanism in codegen to use a proper stack with ClassId identifiers
  • Fixes the private identifier lookup to correctly find mangled names across nested class scopes

Reviewed Changes

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

Show a summary per file
File Description
crates/oxc_mangler/src/lib.rs Changes return type from Vec to IndexVec for class private mappings
crates/oxc_mangler/Cargo.toml Adds oxc_index dependency for IndexVec support
crates/oxc_codegen/src/lib.rs Updates class tracking with proper ClassId-based stack implementation
crates/oxc_codegen/src/gen.rs Fixes private identifier lookup to correctly iterate through class hierarchy
crates/oxc_minifier/tests/mangler/mod.rs Adds test case for different private member names across classes
crates/oxc_minifier/tests/mangler/snapshots/private_member_mangling.snap Test snapshot showing correct mangling output

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 5, 2025

CodSpeed Performance Report

Merging #14361 will not alter performance

Comparing 10-06-fix_mangler_mangle_private_class_members_in_subsequent_classes_correctly (fc519c8) with main (e605222)1

Summary

✅ 37 untouched

Footnotes

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

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Oct 6, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 6, 2025

Merge activity

graphite-app bot pushed a commit that referenced this pull request Oct 6, 2025
@graphite-app graphite-app bot force-pushed the 10-06-fix_mangler_mangle_private_class_members_in_subsequent_classes_correctly branch from 1171718 to 278df87 Compare October 6, 2025 09:26
@graphite-app graphite-app bot force-pushed the 10-06-fix_mangler_mangle_private_class_members_in_subsequent_classes_correctly branch from 278df87 to fc519c8 Compare October 6, 2025 09:29
@graphite-app graphite-app bot merged commit fc519c8 into main Oct 6, 2025
28 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 6, 2025
@graphite-app graphite-app bot deleted the 10-06-fix_mangler_mangle_private_class_members_in_subsequent_classes_correctly branch October 6, 2025 09:35
@Boshen Boshen mentioned this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-minifier Area - Minifier C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mangler: Private member mangling is broken

3 participants