Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inline props should look for attributes #347

Merged
merged 1 commit into from Apr 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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