Skip to content

Commit

Permalink
refactor(transformer/class-properties): pass BoundIdentifiers by re…
Browse files Browse the repository at this point in the history
…ference (#7968)

Don't pass by value when passing by reference is sufficient.
  • Loading branch information
overlookmotel committed Dec 17, 2024
1 parent 69eeeea commit 6fc40f0
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,14 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {

self.transform_static_assignment_expression(
expr,
prop_binding,
class_binding,
&prop_binding,
&class_binding,
class_symbol_id,
is_declaration,
ctx,
);
} else {
self.transform_instance_assignment_expression(expr, prop_binding, ctx);
self.transform_instance_assignment_expression(expr, &prop_binding, ctx);
}
}

Expand All @@ -416,12 +416,11 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
// `AssignmentTarget::PrivateFieldExpression` on left, and that clones in
// `transform_assignment_expression` can be elided.
#[inline]
#[expect(clippy::needless_pass_by_value)]
fn transform_static_assignment_expression(
&self,
expr: &mut Expression<'a>,
prop_binding: BoundIdentifier<'a>,
class_binding: BoundIdentifier<'a>,
prop_binding: &BoundIdentifier<'a>,
class_binding: &BoundIdentifier<'a>,
class_symbol_id: Option<SymbolId>,
is_declaration: bool,
ctx: &mut TraverseCtx<'a>,
Expand Down Expand Up @@ -575,11 +574,10 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
// `AssignmentTarget::PrivateFieldExpression` on left, and that clones in
// `transform_assignment_expression` can be elided.
#[inline]
#[expect(clippy::needless_pass_by_value)]
fn transform_instance_assignment_expression(
&self,
expr: &mut Expression<'a>,
prop_binding: BoundIdentifier<'a>,
prop_binding: &BoundIdentifier<'a>,
ctx: &mut TraverseCtx<'a>,
) {
let assign_expr = match ctx.ast.move_expression(expr) {
Expand Down

0 comments on commit 6fc40f0

Please sign in to comment.