handle rsx!{cx, ...}
This commit is contained in:
1 parent
586e29d815
commit
2a6d9ed075
3 files changed
+15
-5
No files matched your search
@@ -189,8 +189,8 @@ pub fn rsx(s: TokenStream) -> TokenStream {
|
||||
use dioxus_rsx_interpreter::captuered_context::CapturedContextBuilder;
|
||||
|
||||
match CapturedContextBuilder::from_call_body(body) {
|
||||
Ok(captured) => quote::quote! {
|
||||
{
|
||||
Ok(captured) => {
|
||||
let lazy = quote::quote! {
|
||||
LazyNodes::new(move |__cx|{
|
||||
let captured = #captured;
|
||||
let line_num = get_line_num();
|
||||
@@ -198,9 +198,16 @@ pub fn rsx(s: TokenStream) -> TokenStream {
|
||||
|
||||
resolve_scope(line_num, text, captured, __cx)
|
||||
})
|
||||
};
|
||||
if let Some(cx) = captured.custom_context {
|
||||
quote::quote! {
|
||||
#cx.render(#lazy)
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
lazy.into()
|
||||
}
|
||||
}
|
||||
.into(),
|
||||
Err(err) => err.into_compile_error().into(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user