From 0b0802d0a18a0a89acfb99aa328f4697ee2ddbae Mon Sep 17 00:00:00 2001 From: rzvxa Date: Mon, 1 Jul 2024 23:25:59 +0330 Subject: [PATCH] perf: inline `Visit::alloc`. --- crates/oxc_ast/src/generated/visit.rs | 1 + tasks/ast_codegen/src/generators/visit.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/oxc_ast/src/generated/visit.rs b/crates/oxc_ast/src/generated/visit.rs index 9ea569d11ebf7a..de23b063413e24 100644 --- a/crates/oxc_ast/src/generated/visit.rs +++ b/crates/oxc_ast/src/generated/visit.rs @@ -31,6 +31,7 @@ pub trait Visit<'a>: Sized { fn enter_scope(&mut self, flags: ScopeFlags) {} fn leave_scope(&mut self) {} + #[inline] fn alloc(&self, t: &T) -> &'a T { // SAFETY: // This should be safe as long as `src` is an reference from the allocator. diff --git a/tasks/ast_codegen/src/generators/visit.rs b/tasks/ast_codegen/src/generators/visit.rs index 5b6e1927e0be1f..0ae0e3b70f1051 100644 --- a/tasks/ast_codegen/src/generators/visit.rs +++ b/tasks/ast_codegen/src/generators/visit.rs @@ -98,6 +98,7 @@ fn generate_visit(ctx: &CodegenCtx) -> TokenStream { endl!(); + #[inline] fn alloc(&self, t: &T) -> &'a T { insert!("// SAFETY:"); insert!("// This should be safe as long as `src` is an reference from the allocator.");