This commit is contained in:
parent
41f3c46830
commit
b79037b96f
|
@ -78,12 +78,20 @@ impl ViewMacros {
|
|||
for view in visitor.views {
|
||||
let span = view.span();
|
||||
let id = span_to_stable_id(path, span.start().line);
|
||||
let tokens = view.tokens.clone().into_iter();
|
||||
// TODO handle class = ...
|
||||
let rsx =
|
||||
rstml::parse2(tokens.collect::<proc_macro2::TokenStream>())?;
|
||||
let template = LNode::parse_view(rsx)?;
|
||||
views.push(MacroInvocation { id, template });
|
||||
if view.tokens.is_empty() {
|
||||
views.push(MacroInvocation {
|
||||
id,
|
||||
template: LNode::Fragment(Vec::new()),
|
||||
});
|
||||
} else {
|
||||
let tokens = view.tokens.clone().into_iter();
|
||||
// TODO handle class = ...
|
||||
let rsx = rstml::parse2(
|
||||
tokens.collect::<proc_macro2::TokenStream>(),
|
||||
)?;
|
||||
let template = LNode::parse_view(rsx)?;
|
||||
views.push(MacroInvocation { id, template });
|
||||
}
|
||||
}
|
||||
Ok(views)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue