-
-
Notifications
You must be signed in to change notification settings - Fork 710
fix(codegen): avoid invalid sourcemap tokens for positions beyond source bounds #15069
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
CodSpeed Performance ReportMerging #15069 will not alter performanceComparing Summary
|
|
@copilot fix lint error |
There was a problem hiding this 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 an issue where oxc_codegen generates invalid sourcemap tokens for positions beyond the original source content. When the codegen adds semicolons or newlines that don't exist in the original source, it was creating sourcemap mappings with out-of-bounds positions.
- Added bounds validation in
add_source_mapping_end()to skip creating sourcemap tokens whenspan.endis beyond the source text length - Added comprehensive test case validating that all sourcemap tokens have valid source positions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_codegen/src/lib.rs | Added bounds check in add_source_mapping_end to prevent invalid sourcemap tokens for positions beyond source content |
| crates/oxc_codegen/tests/integration/sourcemap.rs | Added test no_invalid_tokens_beyond_source to verify sourcemap tokens are within source bounds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…rce bounds (#15069) Fix invalid sourcemap tokens when oxc_codegen adds punctuation beyond source bounds
ff3ecaf to
3fbb307
Compare
Fix invalid sourcemap tokens when oxc_codegen adds punctuation beyond source bounds