From e843405ecfee06ea158fb0070d4c70c2f228c82c Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Fri, 22 May 2026 09:56:04 +0800 Subject: Refactor renderer to use injected resources directly --- mingling_macros/src/renderer.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'mingling_macros/src/renderer.rs') diff --git a/mingling_macros/src/renderer.rs b/mingling_macros/src/renderer.rs index db04c19..7f85a60 100644 --- a/mingling_macros/src/renderer.rs +++ b/mingling_macros/src/renderer.rs @@ -115,16 +115,14 @@ pub fn renderer_attr(attr: TokenStream, item: TokenStream) -> TokenStream { quote! { #(#fn_body_stmts)* } }; - // Build the original function with resource injection (no `.into()` — signature is exactly as user wrote) + // Build the original function with resource injection - use the resource bindings directly + // from the function parameters rather than re-fetching from context. let original_fn_body = if has_resources { - let wrapped_body = - wrap_body_with_mut_resources(&fn_body_stmts, &mut_resources, program_type); quote! { let mut dummy_r = ::mingling::RenderResult::default(); { let __renderer_inner_result = &mut dummy_r; - #(#immut_resource_stmts)* - #wrapped_body + #(#fn_body_stmts)* } #result_return } -- cgit