refactor(ast): implement RegExpLiteral::parse_pattern#13467
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the regular expression pattern parsing functionality by moving the try_parse_pattern function from oxc_transformer to oxc_ast as a method on RegExpLiteral. This enables the minifier to use the same pattern parsing logic.
Key Changes:
- Adds
parse_patternmethod toRegExpLiteralinoxc_ast - Removes the standalone
try_parse_patternfunction fromoxc_transformer - Updates the
LiteralParserto use separate lifetimes for pattern and flags text
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_transformer/src/regexp/mod.rs | Removed try_parse_pattern function and updated call site to use new method |
| crates/oxc_regular_expression/src/parser/parser_impl.rs | Added separate lifetime parameter for flags text in LiteralParser |
| crates/oxc_ast/src/ast_impl/literal.rs | Added parse_pattern method to RegExpLiteral |
| crates/oxc_ast/Cargo.toml | Added oxc_diagnostics dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13467 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
Moved the parse function to oxc_ast from oxc_transformer to use it from the minifier.
59221b2 to
14c40fd
Compare

Moved the parse function to oxc_ast from oxc_transformer to use it from the minifier.