This commit is contained in:
Graham Kelly 2024-06-06 17:44:40 -04:00
parent 9f16fef6c2
commit 567768bf3f

View file

@ -305,11 +305,14 @@ impl Opts<Module<'static>> {
}; };
let g = self.render_generics(&quote! {c}, &self.module.signatures[*sig_index]); let g = self.render_generics(&quote! {c}, &self.module.signatures[*sig_index]);
quote! { quote! {
match #root::_rexport::tramp::tramp(#root::func::call_ref::<#g,C>(ctx,#root::func::cast(#r.clone()),#root::_rexport::tuple_list::tuple_list!(#(#root::func::cast::<_,_,C>(#vals .clone())),*))){ {
let r = #r.clone();
match #root::_rexport::tramp::tramp(#root::func::call_ref::<#g,C>(ctx,#root::func::cast(r),#root::_rexport::tuple_list::tuple_list!(#(#root::func::cast::<_,_,C>(#vals .clone())),*))){
Ok(a) => a, Ok(a) => a,
Err(e) => return #root::_rexport::tramp::BorrowRec::Ret(Err(e)) Err(e) => return #root::_rexport::tramp::BorrowRec::Ret(Err(e))
} }
} }
}
}, },
Operator::RefFunc { func_index } => { Operator::RefFunc { func_index } => {
self.render_fun_ref(&quote! {C},*func_index) self.render_fun_ref(&quote! {C},*func_index)
@ -577,8 +580,9 @@ impl Opts<Module<'static>> {
}; };
let g = self.render_generics(&quote! {c}, &self.module.signatures[*sig]); let g = self.render_generics(&quote! {c}, &self.module.signatures[*sig]);
quote! { quote! {
let r = #r.clone();
return #root::_rexport::tramp::BorrowRec::Call(#root::_rexport::tramp::Thunk::new(move||{ return #root::_rexport::tramp::BorrowRec::Call(#root::_rexport::tramp::Thunk::new(move||{
#root::func::call_ref::<#g,C>(ctx,#root::func::cast(#r.clone()),#root::_rexport::tuple_list::tuple_list!(#(#root::func::cast::<_,_,C>(#vals .clone())),*)) #root::func::call_ref::<#g,C>(ctx,#root::func::cast(r),#root::_rexport::tuple_list::tuple_list!(#(#root::func::cast::<_,_,C>(#vals .clone())),*))
})) }))
} }
} }
@ -997,7 +1001,7 @@ pub fn go(opts: &Opts<Vec<u8>>) -> proc_macro2::TokenStream {
#(#fs)* #(#fs)*
} }
pub fn init<C: #name>(ctx: &mut C) -> #root::_rexport::anyhow::Result<()>{ pub fn init<C: #name + 'static>(ctx: &mut C) -> #root::_rexport::anyhow::Result<()>{
#(#init);*; #(#init);*;
return Ok(()) return Ok(())
} }