Skip to content

Commit

Permalink
perf: inline Visit::alloc.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jul 2, 2024
1 parent 34db57f commit 2fbe2bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/oxc_ast/src/generated/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub trait Visit<'a>: Sized {
fn enter_scope(&mut self, flags: ScopeFlags) {}
fn leave_scope(&mut self) {}

#[inline]
fn alloc<T>(&self, t: &T) -> &'a T {
// SAFETY:
// This should be safe as long as `src` is an reference from the allocator.
Expand Down
1 change: 1 addition & 0 deletions tasks/ast_codegen/src/generators/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn generate_visit(ctx: &CodegenCtx) -> TokenStream {

endl!();

#[inline]
fn alloc<T>(&self, t: &T) -> &'a T {
insert!("// SAFETY:");
insert!("// This should be safe as long as `src` is an reference from the allocator.");
Expand Down

0 comments on commit 2fbe2bd

Please sign in to comment.