mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
fix: inline props should look for attributes
This commit is contained in:
parent
ab4f75e4ea
commit
24bca45612
1 changed files with 5 additions and 0 deletions
|
@ -7,6 +7,7 @@ use syn::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct InlinePropsBody {
|
pub struct InlinePropsBody {
|
||||||
|
pub attrs: Vec<Attribute>,
|
||||||
pub vis: syn::Visibility,
|
pub vis: syn::Visibility,
|
||||||
pub fn_token: Token![fn],
|
pub fn_token: Token![fn],
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -22,6 +23,7 @@ pub struct InlinePropsBody {
|
||||||
/// The custom rusty variant of parsing rsx!
|
/// The custom rusty variant of parsing rsx!
|
||||||
impl Parse for InlinePropsBody {
|
impl Parse for InlinePropsBody {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream) -> Result<Self> {
|
||||||
|
let attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
|
||||||
let vis: Visibility = input.parse()?;
|
let vis: Visibility = input.parse()?;
|
||||||
|
|
||||||
let fn_token = input.parse()?;
|
let fn_token = input.parse()?;
|
||||||
|
@ -57,6 +59,7 @@ impl Parse for InlinePropsBody {
|
||||||
output,
|
output,
|
||||||
block,
|
block,
|
||||||
cx_token,
|
cx_token,
|
||||||
|
attrs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +75,7 @@ impl ToTokens for InlinePropsBody {
|
||||||
output,
|
output,
|
||||||
block,
|
block,
|
||||||
cx_token,
|
cx_token,
|
||||||
|
attrs,
|
||||||
..
|
..
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
|
@ -136,6 +140,7 @@ impl ToTokens for InlinePropsBody {
|
||||||
#(#fields),*
|
#(#fields),*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#(#attrs)*
|
||||||
#vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output {
|
#vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output {
|
||||||
let #struct_name { #(#field_names),* } = &cx.props;
|
let #struct_name { #(#field_names),* } = &cx.props;
|
||||||
#block
|
#block
|
||||||
|
|
Loading…
Add table
Reference in a new issue