Skip to content

Commit

Permalink
Merge pull request #347 from DioxusLabs/jk/attributes-inlineprops
Browse files Browse the repository at this point in the history
fix: inline props should look for attributes
  • Loading branch information
jkelleyrtp committed Apr 12, 2022
2 parents 87ee8e1 + 24bca45 commit 90a3093
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/core-macro/src/inlineprops.rs
Expand Up @@ -7,6 +7,7 @@ use syn::{
};

pub struct InlinePropsBody {
pub attrs: Vec<Attribute>,
pub vis: syn::Visibility,
pub fn_token: Token![fn],
pub ident: Ident,
Expand All @@ -22,6 +23,7 @@ pub struct InlinePropsBody {
/// The custom rusty variant of parsing rsx!
impl Parse for InlinePropsBody {
fn parse(input: ParseStream) -> Result<Self> {
let attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
let vis: Visibility = input.parse()?;

let fn_token = input.parse()?;
Expand Down Expand Up @@ -57,6 +59,7 @@ impl Parse for InlinePropsBody {
output,
block,
cx_token,
attrs,
})
}
}
Expand All @@ -72,6 +75,7 @@ impl ToTokens for InlinePropsBody {
output,
block,
cx_token,
attrs,
..
} = self;

Expand Down Expand Up @@ -136,6 +140,7 @@ impl ToTokens for InlinePropsBody {
#(#fields),*
}

#(#attrs)*
#vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output {
let #struct_name { #(#field_names),* } = &cx.props;
#block
Expand Down

0 comments on commit 90a3093

Please sign in to comment.