Skip to content

refactor(ast): implement RegExpLiteral::parse_pattern#13467

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-31-refactor_ast_implement_regexpliteral_parse_pattern_
Aug 31, 2025
Merged

refactor(ast): implement RegExpLiteral::parse_pattern#13467
graphite-app[bot] merged 1 commit intomainfrom
08-31-refactor_ast_implement_regexpliteral_parse_pattern_

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 31, 2025

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

@github-actions github-actions bot added A-ast Area - AST A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Aug 31, 2025
Copy link
Member Author

sapphi-red commented Aug 31, 2025


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.

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 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_pattern method to RegExpLiteral in oxc_ast
  • Removes the standalone try_parse_pattern function from oxc_transformer
  • Updates the LiteralParser to 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-hq
Copy link

codspeed-hq bot commented Aug 31, 2025

CodSpeed Instrumentation Performance Report

Merging #13467 will not alter performance

Comparing 08-31-refactor_ast_implement_regexpliteral_parse_pattern_ (14c40fd) with main (946669b)1

Summary

✅ 37 untouched benchmarks

Footnotes

  1. No successful run was found on main (14c40fd) during the generation of this report, so 946669b 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 Aug 31, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 31, 2025

Merge activity

Moved the parse function to oxc_ast from oxc_transformer to use it from the minifier.
@graphite-app graphite-app bot force-pushed the 08-31-refactor_ast_implement_regexpliteral_parse_pattern_ branch from 59221b2 to 14c40fd Compare August 31, 2025 15:15
@graphite-app graphite-app bot merged commit 14c40fd into main Aug 31, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 08-31-refactor_ast_implement_regexpliteral_parse_pattern_ branch August 31, 2025 15:21
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants