Skip to content

Commit

Permalink
Fix error and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechu10 committed Nov 3, 2024
1 parent 96e97d4 commit 6d630cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/sycamore-macro/src/inline_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use proc_macro2::Span;
use quote::format_ident;
use syn::punctuated::Punctuated;
use syn::{
Field, GenericParam, Generics, Ident, Path, PathArguments, PathSegment, Token, Type,
TypeImplTrait, TypeParam, TypePath, Visibility,
Attribute, Field, GenericParam, Generics, Ident, Path, PathArguments, PathSegment, Token, Type, TypeImplTrait, TypeParam, TypePath, Visibility
};

pub fn create_generic_ident(generics: &Generics) -> Ident {
Expand Down Expand Up @@ -85,7 +84,7 @@ pub fn add_generic(generics: &mut Generics, impl_type: TypeImplTrait) -> Type {
})
}

pub fn push_field(fields: &mut Vec<Field>, generics: &mut Generics, attrs: Vec<Attributes>, ident: Ident, ty: Type) {
pub fn push_field(fields: &mut Vec<Field>, generics: &mut Generics, attrs: Vec<Attribute>, ident: Ident, ty: Type) {
let ty = resolve_type(generics, ty);

fields.push(Field {
Expand Down
15 changes: 15 additions & 0 deletions packages/sycamore-macro/tests/component/inline-props-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,19 @@ fn AdditionalStructAttributes(dummy: String) -> View {
}
}

#[component(inline_props)]
fn PropsWithAttributes(
#[prop(default)]
dummy: String,
) -> View {
fn call_component() -> View {
view! {
PropsWithAttributes {}
}
}
view! {
(dummy)
}
}

fn main() {}

0 comments on commit 6d630cd

Please sign in to comment.