Skip to content

Commit

Permalink
refactor(transformer): RegExp transform unbox early (#5504)
Browse files Browse the repository at this point in the history
Unbox the `RegExpLiteral` early to avoid all lookups thereafter going through the indirection of a `Box`.
  • Loading branch information
overlookmotel committed Sep 6, 2024
1 parent d1ece19 commit fad0a05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/oxc_transformer/src/regexp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ impl<'a> Traverse<'a> for RegExp<'a> {
expr: &mut Expression<'a>,
ctx: &mut oxc_traverse::TraverseCtx<'a>,
) {
let Expression::RegExpLiteral(ref mut regexp) = expr else {
let Expression::RegExpLiteral(regexp) = expr else {
return;
};
let regexp = regexp.as_mut();

let flags = regexp.regex.flags;
let has_unsupported_flags = flags.intersects(self.unsupported_flags);
Expand Down

0 comments on commit fad0a05

Please sign in to comment.