From 758a10c515d30e65968ad79d2ec6e0789ee6762f Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:02:44 +0000 Subject: [PATCH] refactor(transformer): RegExp transform reuse var (#5527) Nit. Use local `flags` var instead of `regexp.regex.flags`. --- crates/oxc_transformer/src/regexp/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/oxc_transformer/src/regexp/mod.rs b/crates/oxc_transformer/src/regexp/mod.rs index 64cd91e12396c..8d0b63352d878 100644 --- a/crates/oxc_transformer/src/regexp/mod.rs +++ b/crates/oxc_transformer/src/regexp/mod.rs @@ -177,9 +177,10 @@ impl<'a> Traverse<'a> for RegExp<'a> { ctx.ast.argument_expression(ctx.ast.expression_string_literal(SPAN, pattern_source)), ); - let flags = regexp.regex.flags.to_string(); - let flags = ctx.ast.argument_expression(ctx.ast.expression_string_literal(SPAN, flags)); - arguments.push(flags); + let flags_str = flags.to_string(); + let flags_str = + ctx.ast.argument_expression(ctx.ast.expression_string_literal(SPAN, flags_str)); + arguments.push(flags_str); *expr = ctx.ast.expression_new( regexp.span,