Skip to content

Commit 6fc40f0

Browse files
committed
refactor(transformer/class-properties): pass BoundIdentifiers by reference (#7968)
Don't pass by value when passing by reference is sufficient.
1 parent 69eeeea commit 6fc40f0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

crates/oxc_transformer/src/es2022/class_properties/private_field.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,14 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
389389

390390
self.transform_static_assignment_expression(
391391
expr,
392-
prop_binding,
393-
class_binding,
392+
&prop_binding,
393+
&class_binding,
394394
class_symbol_id,
395395
is_declaration,
396396
ctx,
397397
);
398398
} else {
399-
self.transform_instance_assignment_expression(expr, prop_binding, ctx);
399+
self.transform_instance_assignment_expression(expr, &prop_binding, ctx);
400400
}
401401
}
402402

@@ -416,12 +416,11 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
416416
// `AssignmentTarget::PrivateFieldExpression` on left, and that clones in
417417
// `transform_assignment_expression` can be elided.
418418
#[inline]
419-
#[expect(clippy::needless_pass_by_value)]
420419
fn transform_static_assignment_expression(
421420
&self,
422421
expr: &mut Expression<'a>,
423-
prop_binding: BoundIdentifier<'a>,
424-
class_binding: BoundIdentifier<'a>,
422+
prop_binding: &BoundIdentifier<'a>,
423+
class_binding: &BoundIdentifier<'a>,
425424
class_symbol_id: Option<SymbolId>,
426425
is_declaration: bool,
427426
ctx: &mut TraverseCtx<'a>,
@@ -575,11 +574,10 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
575574
// `AssignmentTarget::PrivateFieldExpression` on left, and that clones in
576575
// `transform_assignment_expression` can be elided.
577576
#[inline]
578-
#[expect(clippy::needless_pass_by_value)]
579577
fn transform_instance_assignment_expression(
580578
&self,
581579
expr: &mut Expression<'a>,
582-
prop_binding: BoundIdentifier<'a>,
580+
prop_binding: &BoundIdentifier<'a>,
583581
ctx: &mut TraverseCtx<'a>,
584582
) {
585583
let assign_expr = match ctx.ast.move_expression(expr) {

0 commit comments

Comments
 (0)