diff --git a/crates/oxc_transformer/src/es2022/class_properties/class.rs b/crates/oxc_transformer/src/es2022/class_properties/class.rs index f77c6b204236d..abe5f7374d603 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/class.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/class.rs @@ -403,6 +403,8 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { } /// Pop from private props stack. + // `#[inline]` because this is function is so small + #[inline] pub(super) fn transform_class_on_exit(&mut self, class: &Class) { // Ignore TS class declarations // TODO: Is this correct? diff --git a/crates/oxc_transformer/src/es2022/class_properties/mod.rs b/crates/oxc_transformer/src/es2022/class_properties/mod.rs index 8270273764883..7de6fe88946ab 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/mod.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/mod.rs @@ -269,6 +269,8 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { } impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> { + // `#[inline]` because this is a hot path + #[inline] fn enter_expression(&mut self, expr: &mut Expression<'a>, ctx: &mut TraverseCtx<'a>) { // Note: `delete this.#prop` is an early syntax error, so no need to handle transforming it match expr { @@ -306,6 +308,8 @@ impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> { } } + // `#[inline]` because this is a hot path + #[inline] fn enter_assignment_target( &mut self, target: &mut AssignmentTarget<'a>, @@ -314,6 +318,8 @@ impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> { self.transform_assignment_target(target, ctx); } + // `#[inline]` because this is a hot path + #[inline] fn enter_statement(&mut self, stmt: &mut Statement<'a>, ctx: &mut TraverseCtx<'a>) { match stmt { // `class C {}` @@ -340,6 +346,8 @@ impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> { } } + // `#[inline]` because `transform_class_on_exit` is so small + #[inline] fn exit_class(&mut self, class: &mut Class<'a>, _ctx: &mut TraverseCtx<'a>) { self.transform_class_on_exit(class); }