diff --git a/tools/generate-code/src/generators/visitor.rs b/tools/generate-code/src/generators/visitor.rs index 599422574871..026f2358c34b 100644 --- a/tools/generate-code/src/generators/visitor.rs +++ b/tools/generate-code/src/generators/visitor.rs @@ -459,6 +459,7 @@ impl Generator { trait_methods.push(parse_quote!( #method_doc + #[inline] fn #visit_method_name #lifetime (&mut self, node: #type_param #ast_path_params) #return_type { <#node_type as #with_trait_name>::#visit_with_children_name(node, self #ast_path_arg) } @@ -1063,10 +1064,12 @@ impl Generator { #(#attrs)* impl #visit_with_trait_name for #target_type { #visit_with_doc + #[inline] fn #visit_with_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { ::#visit_method_name(visitor, self #ast_path_arg) } + #[inline] fn #visit_with_children_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { #default_body } @@ -1115,11 +1118,13 @@ impl Generator { impl #visit_with_trait_name for std::boxed::Box where V: ?Sized + #visit_trait_name, T: #visit_with_trait_name { + #[inline] fn #visit_with_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { swc_visit::util::map::Map::map(self, |inner| { >::#visit_with_name(inner, visitor #ast_path_arg) }) } + #[inline] fn #visit_with_children_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { swc_visit::util::map::Map::map(self, |inner| { >::#visit_with_children_name(inner, visitor #ast_path_arg) @@ -1159,11 +1164,13 @@ impl Generator { impl #visit_with_trait_name for std::boxed::Box where V: ?Sized + #visit_trait_name, T: #visit_with_trait_name { + #[inline] fn #visit_with_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { let v = >::#visit_with_name(#deref_expr, visitor #ast_path_arg); #restore_expr v } + #[inline] fn #visit_with_children_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { let v = >::#visit_with_children_name(#deref_expr, visitor #ast_path_arg); #restore_expr @@ -1182,11 +1189,13 @@ impl Generator { impl #visit_with_trait_name for std::vec::Vec where V: ?Sized + #visit_trait_name, [T]: #visit_with_trait_name { + #[inline] fn #visit_with_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { let v = <[T] as #visit_with_trait_name>::#visit_with_name(self, visitor #ast_path_arg); v } + #[inline] fn #visit_with_children_name #lifetime (#receiver, visitor: &mut V #ast_path_param) #return_type { let v = <[T] as #visit_with_trait_name>::#visit_with_children_name(self, visitor #ast_path_arg); v