refactor(ast_tools): move variants generator into output module#14372
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
12ef84a to
2fa6607
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the variant generation functionality from the raw transfer generator into a reusable VariantGenerator trait in the output module. The purpose is to extract and generalize the logic for generating multiple JavaScript deserializer variants using feature flags and dead code elimination.
Key changes:
- Created a new
VariantGeneratortrait in the JavaScript output module for generating code variants with feature flags - Moved minification and AST processing utilities from the raw transfer generator to the output module
- Refactored the raw transfer generator to use the new trait instead of inline variant generation logic
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/output/mod.rs | Made javascript module public to expose the new VariantGenerator trait |
| tasks/ast_tools/src/output/javascript.rs | Added VariantGenerator trait and supporting utilities for generating code variants with feature flags |
| tasks/ast_tools/src/generators/raw_transfer.rs | Refactored to use the new VariantGenerator trait, removing duplicate code and simplifying variant generation logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
…4372) Pure refactor. Codegen for raw transfer contains logic for generating multiple deserializer variants from a single base implementation, using feature flags to gate certain code, and minifier to shake out dead code in each (#14312). Abstract this functionality into a `VariantGenerator` trait, and move it into the `output` module. This allows reusing the same functionality for other generators.
2fa6607 to
515e08a
Compare

Pure refactor.
Codegen for raw transfer contains logic for generating multiple deserializer variants from a single base implementation, using feature flags to gate certain code, and minifier to shake out dead code in each (#14312).
Abstract this functionality into a
VariantGeneratortrait, and move it into theoutputmodule. This allows reusing the same functionality for other generators.