-
-
Notifications
You must be signed in to change notification settings - Fork 720
fix(codegen): print legal comments above directives #14993
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. |
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 the handling of legal comments that appear before directives (like "use strict"), ensuring they are preserved in the generated code rather than being dropped.
Key changes:
- Modified the
Directive::genimplementation to print leading comments before outputting the directive itself - Added test coverage for legal comments appearing above directives
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_codegen/src/gen.rs | Added print_comments_at call to preserve legal comments before directives |
| crates/oxc_codegen/tests/integration/comments.rs | Added test case for legal comments above directives |
| crates/oxc_codegen/tests/integration/snapshots/*.snap | Updated snapshots to reflect the fix and test framework changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/oxc_codegen/tests/integration/snapshots/legal_eof_minify_comments.snap
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #14993 will not alter performanceComparing Summary
Footnotes |
098c973 to
09ea312
Compare
Merge activity
|
## Summary Fixes #14953 Legal comments (e.g., `/*! ... */`) that appear before directives like `"use strict"` are now properly preserved in the generated code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
09ea312 to
4904710
Compare
Summary
Fixes #14953
Legal comments (e.g.,
/*! ... */) that appear before directives like"use strict"are now properly preserved in the generated code.🤖 Generated with Claude Code