feat: signifiantly improved error reporting in `view` macro (#2289)
* Added name span to .build in component_to_tokens * Added #[allow(unreachable_code)] to leptos::component_view inside component_to_tokens * Added span to name reference in component_to_tokens * Added span to leptos::component_props_builder in component_to_tokens * Added span to props in component_to_tokens * Added span to "on" method in events component_to_tokens * Added spans in directive_call_from_attribute_node * Added spans in fragment_to_tokens and it's ssr version * Added span to props in slot_to_tokens * Added span to the whole slot quote * Changed slots's name span to last slot node * Added span to the slot vec * Added #[allow(unreachable_code)] to `.into()` in slot_to_tokens * Added span to `.build()` in slot_to_tokens * Added span for the whole component * Added span to "clone:" directive * Added span to ".children()" * Removed unused "_span" param from fragment_to_tokens and fragment_to_tokens_ssr * Removed unnecessary parenthesis around values in `attribute_to_tokens` * Removed unnecessary curly braces around value in `spread_attrs` * Removed unnecessary parenthesis around children in `element_to_tokens` * Added catch-all span to element_to_tokens * Formatted `quote!` according to official guidelines * Updated view/snapshots in leptos_macro * Added span to spread props in element_to_tokens_ssr * Removed unnecessary curly braces in element_to_token_ssr * Updated view/snapshots in leptos_macro * Added view macro tests to leptos_macro * Fixed clippy warnings in view macro output * Updated view snapshots in tests * Fixed expected_one_let_bind_got_none test in leptos_macro * Removed snapshot tests in leptos_macro/tests/ui/view --------- Co-authored-by: Greg Johnston <greg.johnston@gmail.com>
This commit is contained in:
parent
ab1c4ca7a6
commit
36b2f919dd
|
@ -24,7 +24,6 @@ pub(crate) enum TagType {
|
|||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn fragment_to_tokens(
|
||||
_span: Span,
|
||||
nodes: &[Node],
|
||||
lazy: bool,
|
||||
parent_type: TagType,
|
||||
|
@ -35,9 +34,16 @@ pub(crate) fn fragment_to_tokens(
|
|||
let mut slots = HashMap::new();
|
||||
let has_slots = parent_slots.is_some();
|
||||
|
||||
let original_span = nodes
|
||||
.first()
|
||||
.zip(nodes.last())
|
||||
.and_then(|(first, last)| first.span().join(last.span()))
|
||||
.unwrap_or_else(Span::call_site);
|
||||
|
||||
let mut nodes = nodes
|
||||
.iter()
|
||||
.filter_map(|node| {
|
||||
let span = node.span();
|
||||
let node = node_to_tokens(
|
||||
node,
|
||||
parent_type,
|
||||
|
@ -46,8 +52,12 @@ pub(crate) fn fragment_to_tokens(
|
|||
None,
|
||||
)?;
|
||||
|
||||
let node = quote_spanned! {span=>
|
||||
#[allow(unused_braces)] {#node}
|
||||
};
|
||||
|
||||
Some(quote! {
|
||||
::leptos::IntoView::into_view(#[allow(unused_braces)] {#node})
|
||||
::leptos::IntoView::into_view(#node)
|
||||
})
|
||||
})
|
||||
.peekable();
|
||||
|
@ -72,7 +82,7 @@ pub(crate) fn fragment_to_tokens(
|
|||
};
|
||||
|
||||
let tokens = if lazy {
|
||||
quote! {
|
||||
quote_spanned! {original_span=>
|
||||
{
|
||||
::leptos::Fragment::lazy(|| ::std::vec![
|
||||
#(#nodes),*
|
||||
|
@ -81,7 +91,7 @@ pub(crate) fn fragment_to_tokens(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
quote_spanned! {original_span=>
|
||||
{
|
||||
::leptos::Fragment::new(::std::vec![
|
||||
#(#nodes),*
|
||||
|
@ -112,7 +122,6 @@ pub(crate) fn node_to_tokens(
|
|||
) -> Option<TokenStream> {
|
||||
match node {
|
||||
Node::Fragment(fragment) => fragment_to_tokens(
|
||||
Span::call_site(),
|
||||
&fragment.children,
|
||||
true,
|
||||
parent_type,
|
||||
|
@ -169,7 +178,7 @@ pub(crate) fn element_to_tokens(
|
|||
let name = if is_custom_element(&tag) {
|
||||
let name = node.name().to_string();
|
||||
// link custom ident to name span for IDE docs
|
||||
let custom = Ident::new("custom", name.span());
|
||||
let custom = Ident::new("custom", node.name().span());
|
||||
quote! { ::leptos::leptos_dom::html::#custom(::leptos::leptos_dom::html::Custom::new(#name)) }
|
||||
} else if is_svg_element(&tag) {
|
||||
parent_type = TagType::Svg;
|
||||
|
@ -237,9 +246,7 @@ pub(crate) fn element_to_tokens(
|
|||
..
|
||||
}),
|
||||
_,
|
||||
) => Some(
|
||||
quote! { .bindings(#[allow(unused_brace)] {#end}) },
|
||||
),
|
||||
) => Some(quote! { .bindings(#end) }),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
|
@ -276,14 +283,7 @@ pub(crate) fn element_to_tokens(
|
|||
});
|
||||
let global_class_expr = match global_class {
|
||||
None => quote! {},
|
||||
Some(class) => {
|
||||
quote! {
|
||||
.classes(
|
||||
#[allow(unused_braces)]
|
||||
{#class}
|
||||
)
|
||||
}
|
||||
}
|
||||
Some(class) => quote! { .classes(#class) },
|
||||
};
|
||||
|
||||
if is_self_closing(node) && !node.children.is_empty() {
|
||||
|
@ -295,65 +295,48 @@ pub(crate) fn element_to_tokens(
|
|||
);
|
||||
}
|
||||
|
||||
let children = node.children.iter().map(|node| {
|
||||
let (child, is_static) = match node {
|
||||
Node::Fragment(fragment) => (
|
||||
fragment_to_tokens(
|
||||
Span::call_site(),
|
||||
&fragment.children,
|
||||
true,
|
||||
parent_type,
|
||||
None,
|
||||
global_class,
|
||||
None,
|
||||
)
|
||||
.unwrap_or(quote_spanned! {
|
||||
Span::call_site()=> ::leptos::leptos_dom::Unit
|
||||
}),
|
||||
false,
|
||||
),
|
||||
Node::Text(node) => (quote! { #node }, true),
|
||||
let children = node
|
||||
.children
|
||||
.iter()
|
||||
.map(|node| match node {
|
||||
Node::Fragment(fragment) => fragment_to_tokens(
|
||||
&fragment.children,
|
||||
true,
|
||||
parent_type,
|
||||
None,
|
||||
global_class,
|
||||
None,
|
||||
)
|
||||
.unwrap_or(quote_spanned! {
|
||||
Span::call_site()=> ::leptos::leptos_dom::Unit
|
||||
}),
|
||||
Node::Text(node) => quote! { #node },
|
||||
Node::RawText(node) => {
|
||||
let text = node.to_string_best();
|
||||
let text = syn::LitStr::new(&text, node.span());
|
||||
(quote! { #text }, true)
|
||||
quote! { #text }
|
||||
}
|
||||
Node::Block(node) => (
|
||||
quote! {
|
||||
#node
|
||||
},
|
||||
false,
|
||||
),
|
||||
Node::Element(node) => (
|
||||
element_to_tokens(
|
||||
node,
|
||||
parent_type,
|
||||
None,
|
||||
global_class,
|
||||
None,
|
||||
)
|
||||
.unwrap_or_default(),
|
||||
false,
|
||||
),
|
||||
Node::Comment(_) | Node::Doctype(_) => (quote! {}, false),
|
||||
};
|
||||
if is_static {
|
||||
quote! {
|
||||
.child(#child)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
.child((#child))
|
||||
}
|
||||
}
|
||||
});
|
||||
Node::Block(node) => quote! { #node },
|
||||
Node::Element(node) => element_to_tokens(
|
||||
node,
|
||||
parent_type,
|
||||
None,
|
||||
global_class,
|
||||
None,
|
||||
)
|
||||
.unwrap_or_default(),
|
||||
Node::Comment(_) | Node::Doctype(_) => quote! {},
|
||||
})
|
||||
.map(|node| quote!(.child(#node)));
|
||||
|
||||
let view_marker = if let Some(marker) = view_marker {
|
||||
quote! { .with_view_marker(#marker) }
|
||||
} else {
|
||||
quote! {}
|
||||
};
|
||||
let ide_helper_close_tag = ide_helper_close_tag.into_iter();
|
||||
Some(quote! {
|
||||
Some(quote_spanned! {node.span()=>
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
#(#ide_helper_close_tag)*
|
||||
#name
|
||||
|
@ -453,7 +436,7 @@ pub(crate) fn attribute_to_tokens(
|
|||
prop.span()=> .prop
|
||||
};
|
||||
quote! {
|
||||
#prop(#name, #[allow(unused_braces)] {#value})
|
||||
#prop(#name, #value)
|
||||
}
|
||||
} else if let Some(name) = name.strip_prefix("class:") {
|
||||
let value = attribute_value(node);
|
||||
|
@ -465,7 +448,7 @@ pub(crate) fn attribute_to_tokens(
|
|||
class.span()=> .class
|
||||
};
|
||||
quote! {
|
||||
#class(#name, #[allow(unused_braces)] {#value})
|
||||
#class(#name, #value)
|
||||
}
|
||||
} else if let Some(name) = name.strip_prefix("style:") {
|
||||
let value = attribute_value(node);
|
||||
|
@ -477,7 +460,7 @@ pub(crate) fn attribute_to_tokens(
|
|||
style.span()=> .style
|
||||
};
|
||||
quote! {
|
||||
#style(#name, #[allow(unused_braces)] {#value})
|
||||
#style(#name, #value)
|
||||
}
|
||||
} else {
|
||||
let name = name.replacen("attr:", "", 1);
|
||||
|
@ -520,7 +503,7 @@ pub(crate) fn attribute_to_tokens(
|
|||
}
|
||||
};
|
||||
quote! {
|
||||
#attr(#name, (#value))
|
||||
#attr(#name, #value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use super::{
|
|||
};
|
||||
use crate::view::directive_call_from_attribute_node;
|
||||
use proc_macro2::{Ident, TokenStream, TokenTree};
|
||||
use quote::{format_ident, quote};
|
||||
use quote::{format_ident, quote, quote_spanned};
|
||||
use rstml::node::{NodeAttribute, NodeElement};
|
||||
use std::collections::HashMap;
|
||||
use syn::spanned::Spanned;
|
||||
|
@ -18,7 +18,6 @@ pub(crate) fn component_to_tokens(
|
|||
let name = node.name();
|
||||
#[cfg(debug_assertions)]
|
||||
let component_name = ident_from_tag_name(node.name());
|
||||
let span = node.name().span();
|
||||
|
||||
let attrs = node.attributes().iter().filter_map(|node| {
|
||||
if let NodeAttribute::Attribute(node) = node {
|
||||
|
@ -47,8 +46,12 @@ pub(crate) fn component_to_tokens(
|
|||
})
|
||||
.unwrap_or_else(|| quote! { #name });
|
||||
|
||||
quote! {
|
||||
.#name(#[allow(unused_braces)] {#value})
|
||||
let value = quote_spanned! {value.span()=>
|
||||
#[allow(unused_braces)] {#value}
|
||||
};
|
||||
|
||||
quote_spanned! {attr.span()=>
|
||||
.#name(#value)
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -77,9 +80,9 @@ pub(crate) fn component_to_tokens(
|
|||
.filter(|attr| attr.key.to_string().starts_with("on:"))
|
||||
.map(|attr| {
|
||||
let (event_type, handler) = event_from_attribute_node(attr, true);
|
||||
|
||||
let on = quote_spanned!(attr.key.span()=> on);
|
||||
quote! {
|
||||
.on(#event_type, #handler)
|
||||
.#on(#event_type, #handler)
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -119,17 +122,7 @@ pub(crate) fn component_to_tokens(
|
|||
let children = if node.children.is_empty() {
|
||||
quote! {}
|
||||
} else {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(debug_assertions)] {
|
||||
let marker = format!("<{component_name}/>-children");
|
||||
let view_marker = quote! { .with_view_marker(#marker) };
|
||||
} else {
|
||||
let view_marker = quote! {};
|
||||
}
|
||||
}
|
||||
|
||||
let children = fragment_to_tokens(
|
||||
span,
|
||||
&node.children,
|
||||
true,
|
||||
TagType::Unknown,
|
||||
|
@ -138,16 +131,28 @@ pub(crate) fn component_to_tokens(
|
|||
None,
|
||||
);
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(debug_assertions)] {
|
||||
let marker = format!("<{component_name}/>-children");
|
||||
// For some reason spanning for `.children` breaks, unless `#view_marker`
|
||||
// is also covered by `children.span()`.
|
||||
let view_marker = quote_spanned!(children.span()=> .with_view_marker(#marker));
|
||||
} else {
|
||||
let view_marker = quote! {};
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(children) = children {
|
||||
let bindables =
|
||||
items_to_bind.iter().map(|ident| quote! { #ident, });
|
||||
|
||||
let clonables = items_to_clone
|
||||
.iter()
|
||||
.map(|ident| quote! { let #ident = #ident.clone(); });
|
||||
let clonables = items_to_clone.iter().map(|ident| {
|
||||
let ident_ref = quote_spanned!(ident.span()=> &#ident);
|
||||
quote! { let #ident = ::core::clone::Clone::clone(#ident_ref); }
|
||||
});
|
||||
|
||||
if bindables.len() > 0 {
|
||||
quote! {
|
||||
quote_spanned! {children.span()=>
|
||||
.children({
|
||||
#(#clonables)*
|
||||
|
||||
|
@ -155,7 +160,7 @@ pub(crate) fn component_to_tokens(
|
|||
})
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
quote_spanned! {children.span()=>
|
||||
.children({
|
||||
#(#clonables)*
|
||||
|
||||
|
@ -168,18 +173,23 @@ pub(crate) fn component_to_tokens(
|
|||
}
|
||||
};
|
||||
|
||||
let slots = slots.drain().map(|(slot, values)| {
|
||||
let slots = slots.drain().map(|(slot, mut values)| {
|
||||
let span = values
|
||||
.last()
|
||||
.expect("List of slots must not be empty")
|
||||
.span();
|
||||
let slot = Ident::new(&slot, span);
|
||||
if values.len() > 1 {
|
||||
quote! {
|
||||
.#slot(::std::vec![
|
||||
let value = if values.len() > 1 {
|
||||
quote_spanned! {span=>
|
||||
::std::vec![
|
||||
#(#values)*
|
||||
])
|
||||
]
|
||||
}
|
||||
} else {
|
||||
let value = &values[0];
|
||||
quote! { .#slot(#value) }
|
||||
}
|
||||
values.remove(0)
|
||||
};
|
||||
|
||||
quote! { .#slot(#value) }
|
||||
});
|
||||
|
||||
let generics = &node.open_tag.generics;
|
||||
|
@ -189,17 +199,38 @@ pub(crate) fn component_to_tokens(
|
|||
quote! {}
|
||||
};
|
||||
|
||||
let name_ref = quote_spanned! {name.span()=>
|
||||
&#name
|
||||
};
|
||||
|
||||
let build = quote_spanned! {name.span()=>
|
||||
.build()
|
||||
};
|
||||
|
||||
let component_props_builder = quote_spanned! {name.span()=>
|
||||
::leptos::component_props_builder(#name_ref #generics)
|
||||
};
|
||||
|
||||
#[allow(unused_mut)] // used in debug
|
||||
let mut component = quote! {
|
||||
::leptos::component_view(
|
||||
&#name,
|
||||
::leptos::component_props_builder(&#name #generics)
|
||||
let mut component = quote_spanned! {node.span()=>
|
||||
{
|
||||
let props = #component_props_builder
|
||||
#(#props)*
|
||||
#(#slots)*
|
||||
#children
|
||||
.build()
|
||||
#dyn_attrs
|
||||
)
|
||||
#children;
|
||||
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props
|
||||
#build
|
||||
#dyn_attrs;
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
#name_ref,
|
||||
props
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
// (Temporarily?) removed
|
||||
|
@ -210,7 +241,7 @@ pub(crate) fn component_to_tokens(
|
|||
if events_and_directives.is_empty() {
|
||||
component
|
||||
} else {
|
||||
quote! {
|
||||
quote_spanned! {node.span()=>
|
||||
::leptos::IntoView::into_view(#[allow(unused_braces)] {#component})
|
||||
#(#events_and_directives)*
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ pub(crate) fn render_view(
|
|||
call_site,
|
||||
),
|
||||
_ => server_template::fragment_to_tokens_ssr(
|
||||
Span::call_site(),
|
||||
nodes,
|
||||
global_class,
|
||||
call_site,
|
||||
|
@ -56,7 +55,6 @@ pub(crate) fn render_view(
|
|||
)
|
||||
.unwrap_or_default(),
|
||||
_ => client_builder::fragment_to_tokens(
|
||||
Span::call_site(),
|
||||
nodes,
|
||||
true,
|
||||
client_builder::TagType::Unknown,
|
||||
|
@ -422,7 +420,7 @@ fn fancy_class_name<'a>(
|
|||
let value = &tuple.elems[1];
|
||||
return Some((
|
||||
quote! {
|
||||
#class(#class_name, (#value))
|
||||
#class(#class_name, #value)
|
||||
},
|
||||
class_name,
|
||||
value,
|
||||
|
@ -491,7 +489,7 @@ fn fancy_style_name<'a>(
|
|||
let value = &tuple.elems[1];
|
||||
return Some((
|
||||
quote! {
|
||||
#style(#style_name, (#value))
|
||||
#style(#style_name, #value)
|
||||
},
|
||||
style_name,
|
||||
value,
|
||||
|
@ -537,10 +535,10 @@ pub(crate) fn directive_call_from_attribute_node(
|
|||
let handler = syn::Ident::new(directive_name, attr.key.span());
|
||||
|
||||
let param = if let Some(value) = attr.value() {
|
||||
quote! { ::std::convert::Into::into(#value) }
|
||||
quote!(::std::convert::Into::into(#value))
|
||||
} else {
|
||||
quote! { ().into() }
|
||||
quote_spanned!(attr.key.span()=> ().into())
|
||||
};
|
||||
|
||||
quote! { .directive(#handler, #param) }
|
||||
quote! { .directive(#handler, #[allow(clippy::useless_conversion)] #param) }
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use leptos_hot_reload::parsing::{
|
|||
block_to_primitive_expression, is_component_node, value_to_string,
|
||||
};
|
||||
use proc_macro2::{Ident, Span, TokenStream, TokenTree};
|
||||
use quote::quote;
|
||||
use quote::{quote, quote_spanned};
|
||||
use rstml::node::{
|
||||
KeyedAttribute, Node, NodeAttribute, NodeBlock, NodeElement,
|
||||
};
|
||||
|
@ -34,7 +34,6 @@ pub(crate) fn root_node_to_tokens_ssr(
|
|||
) -> TokenStream {
|
||||
match node {
|
||||
Node::Fragment(fragment) => fragment_to_tokens_ssr(
|
||||
Span::call_site(),
|
||||
&fragment.children,
|
||||
global_class,
|
||||
view_marker,
|
||||
|
@ -65,23 +64,35 @@ pub(crate) fn root_node_to_tokens_ssr(
|
|||
}
|
||||
|
||||
pub(crate) fn fragment_to_tokens_ssr(
|
||||
_span: Span,
|
||||
nodes: &[Node],
|
||||
global_class: Option<&TokenTree>,
|
||||
view_marker: Option<String>,
|
||||
) -> TokenStream {
|
||||
let original_span = nodes
|
||||
.first()
|
||||
.zip(nodes.last())
|
||||
.and_then(|(first, last)| first.span().join(last.span()))
|
||||
.unwrap_or_else(Span::call_site);
|
||||
|
||||
let view_marker = if let Some(marker) = view_marker {
|
||||
quote! { .with_view_marker(#marker) }
|
||||
} else {
|
||||
quote! {}
|
||||
};
|
||||
|
||||
let nodes = nodes.iter().map(|node| {
|
||||
let span = node.span();
|
||||
let node = root_node_to_tokens_ssr(node, global_class, None);
|
||||
let node = quote_spanned! {span=>
|
||||
#[allow(unused_braces)] {#node}
|
||||
};
|
||||
|
||||
quote! {
|
||||
::leptos::IntoView::into_view(#[allow(unused_braces)] {#node})
|
||||
::leptos::IntoView::into_view(#node)
|
||||
}
|
||||
});
|
||||
quote! {
|
||||
|
||||
quote_spanned! {original_span=>
|
||||
{
|
||||
::leptos::Fragment::lazy(|| ::std::vec![
|
||||
#(#nodes),*
|
||||
|
@ -281,8 +292,10 @@ fn element_to_tokens_ssr(
|
|||
// should basically be the resolved attributes, joined on spaces, placed into
|
||||
// the template
|
||||
template.push_str(" {}");
|
||||
holes.push(quote! {
|
||||
{#end}.into_iter().filter_map(|(name, attr)| {
|
||||
let end_into_iter =
|
||||
quote_spanned!(end.span()=> {#end}.into_iter());
|
||||
holes.push(quote_spanned! {block.span()=>
|
||||
#end_into_iter.filter_map(|(name, attr)| {
|
||||
Some(::std::format!(
|
||||
"{}=\"{}\"",
|
||||
name,
|
||||
|
@ -372,14 +385,14 @@ fn element_to_tokens_ssr(
|
|||
})
|
||||
}
|
||||
chunks.push(SsrElementChunks::View(quote! {
|
||||
::leptos::IntoView::into_view(#[allow(unused_braces)] {#block})
|
||||
::leptos::IntoView::into_view(#block)
|
||||
}));
|
||||
}
|
||||
}
|
||||
// Keep invalid blocks for faster IDE diff (on user type)
|
||||
Node::Block(block @ NodeBlock::Invalid { .. }) => {
|
||||
chunks.push(SsrElementChunks::View(quote! {
|
||||
::leptos::IntoView::into_view(#[allow(unused_braces)] {#block})
|
||||
::leptos::IntoView::into_view(#block)
|
||||
}));
|
||||
}
|
||||
Node::Fragment(_) => abort!(
|
||||
|
@ -475,7 +488,7 @@ fn attribute_to_tokens_ssr<'a>(
|
|||
} else {
|
||||
template.push_str("{}");
|
||||
holes.push(quote! {
|
||||
&::leptos::IntoAttribute::into_attribute(#[allow(unused_braces)] {#value})
|
||||
&::leptos::IntoAttribute::into_attribute(#value)
|
||||
.as_nameless_value_string()
|
||||
.map(|a| ::std::format!(
|
||||
"{}=\"{}\"",
|
||||
|
|
|
@ -3,7 +3,7 @@ use super::{
|
|||
convert_to_snake_case, ident_from_tag_name,
|
||||
};
|
||||
use proc_macro2::{Ident, TokenStream, TokenTree};
|
||||
use quote::{format_ident, quote};
|
||||
use quote::{format_ident, quote, quote_spanned};
|
||||
use rstml::node::{KeyedAttribute, NodeAttribute, NodeElement};
|
||||
use std::collections::HashMap;
|
||||
use syn::spanned::Spanned;
|
||||
|
@ -23,11 +23,10 @@ pub(crate) fn slot_to_tokens(
|
|||
});
|
||||
|
||||
let component_name = ident_from_tag_name(node.name());
|
||||
let span = node.name().span();
|
||||
|
||||
let Some(parent_slots) = parent_slots else {
|
||||
proc_macro_error::emit_error!(
|
||||
span,
|
||||
node.name().span(),
|
||||
"slots cannot be used inside HTML elements"
|
||||
);
|
||||
return;
|
||||
|
@ -62,8 +61,12 @@ pub(crate) fn slot_to_tokens(
|
|||
})
|
||||
.unwrap_or_else(|| quote! { #name });
|
||||
|
||||
quote! {
|
||||
.#name(#[allow(unused_braces)] {#value})
|
||||
let value = quote_spanned! {value.span()=>
|
||||
#[allow(unused_braces)] {#value}
|
||||
};
|
||||
|
||||
quote_spanned! {attr.span()=>
|
||||
.#name(#value)
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -109,17 +112,7 @@ pub(crate) fn slot_to_tokens(
|
|||
let children = if node.children.is_empty() {
|
||||
quote! {}
|
||||
} else {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(debug_assertions)] {
|
||||
let marker = format!("<{component_name}/>-children");
|
||||
let view_marker = quote! { .with_view_marker(#marker) };
|
||||
} else {
|
||||
let view_marker = quote! {};
|
||||
}
|
||||
}
|
||||
|
||||
let children = fragment_to_tokens(
|
||||
span,
|
||||
&node.children,
|
||||
true,
|
||||
TagType::Unknown,
|
||||
|
@ -128,16 +121,28 @@ pub(crate) fn slot_to_tokens(
|
|||
None,
|
||||
);
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(debug_assertions)] {
|
||||
let marker = format!("<{component_name}/>-children");
|
||||
// For some reason spanning for `.children` breaks, unless `#view_marker`
|
||||
// is also covered by `children.span()`.
|
||||
let view_marker = quote_spanned!(children.span()=> .with_view_marker(#marker));
|
||||
} else {
|
||||
let view_marker = quote! {};
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(children) = children {
|
||||
let bindables =
|
||||
items_to_bind.iter().map(|ident| quote! { #ident, });
|
||||
|
||||
let clonables = items_to_clone
|
||||
.iter()
|
||||
.map(|ident| quote! { let #ident = #ident.clone(); });
|
||||
let clonables = items_to_clone.iter().map(|ident| {
|
||||
let ident_ref = quote_spanned!(ident.span()=> &#ident);
|
||||
quote! { let #ident = ::core::clone::Clone::clone(#ident_ref); }
|
||||
});
|
||||
|
||||
if bindables.len() > 0 {
|
||||
quote! {
|
||||
quote_spanned! {children.span()=>
|
||||
.children({
|
||||
#(#clonables)*
|
||||
|
||||
|
@ -145,7 +150,7 @@ pub(crate) fn slot_to_tokens(
|
|||
})
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
quote_spanned! {children.span()=>
|
||||
.children({
|
||||
#(#clonables)*
|
||||
|
||||
|
@ -158,28 +163,41 @@ pub(crate) fn slot_to_tokens(
|
|||
}
|
||||
};
|
||||
|
||||
let slots = slots.drain().map(|(slot, values)| {
|
||||
let slots = slots.drain().map(|(slot, mut values)| {
|
||||
let span = values
|
||||
.last()
|
||||
.expect("List of slots must not be empty")
|
||||
.span();
|
||||
let slot = Ident::new(&slot, span);
|
||||
if values.len() > 1 {
|
||||
quote! {
|
||||
.#slot(::std::vec![
|
||||
let value = if values.len() > 1 {
|
||||
quote_spanned! {span=>
|
||||
::std::vec![
|
||||
#(#values)*
|
||||
])
|
||||
]
|
||||
}
|
||||
} else {
|
||||
let value = &values[0];
|
||||
quote! { .#slot(#value) }
|
||||
}
|
||||
values.remove(0)
|
||||
};
|
||||
|
||||
quote! { .#slot(#value) }
|
||||
});
|
||||
|
||||
let slot = quote! {
|
||||
#component_name::builder()
|
||||
#(#props)*
|
||||
#(#slots)*
|
||||
#children
|
||||
.build()
|
||||
#dyn_attrs
|
||||
.into(),
|
||||
let build = quote_spanned! {node.name().span()=>
|
||||
.build()
|
||||
};
|
||||
|
||||
let slot = quote_spanned! {node.span()=>
|
||||
#[allow(unused_braces)] {
|
||||
let slot = #component_name::builder()
|
||||
#(#props)*
|
||||
#(#slots)*
|
||||
#children
|
||||
#build
|
||||
#dyn_attrs;
|
||||
|
||||
#[allow(unreachable_code, clippy::useless_conversion)]
|
||||
slot.into()
|
||||
},
|
||||
};
|
||||
|
||||
parent_slots
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::component_view(
|
||||
&SimpleCounter,
|
||||
::leptos::component_props_builder(&SimpleCounter)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&SimpleCounter)
|
||||
.initial_value(#[allow(unused_braces)] { 0 })
|
||||
.step(#[allow(unused_braces)] { 1 })
|
||||
.build(),
|
||||
)
|
||||
.step(#[allow(unused_braces)] { 1 });
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&SimpleCounter,
|
||||
props,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::IntoView::into_view(
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
::leptos::component_view(
|
||||
&ExternalComponent,
|
||||
::leptos::component_props_builder(&ExternalComponent).build(),
|
||||
)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&ExternalComponent);
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&ExternalComponent,
|
||||
props,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
.on(
|
||||
|
|
|
@ -1,66 +1,52 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -68,16 +54,19 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Ident {
|
||||
sym: initial_value,
|
||||
|
@ -89,22 +78,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -114,12 +108,15 @@ TokenStream [
|
|||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Ident {
|
||||
sym: step,
|
||||
|
@ -131,22 +128,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -156,20 +158,231 @@ TokenStream [
|
|||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,40 +1,50 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: IntoView,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: into_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -42,84 +52,74 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -127,29 +127,242 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
|
@ -157,6 +370,7 @@ TokenStream [
|
|||
},
|
||||
Ident {
|
||||
sym: on,
|
||||
span: bytes(29..50),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::component_view(
|
||||
&SimpleCounter,
|
||||
::leptos::component_props_builder(&SimpleCounter)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&SimpleCounter)
|
||||
.initial_value(#[allow(unused_braces)] { 0 })
|
||||
.step(#[allow(unused_braces)] { 1 })
|
||||
.build(),
|
||||
)
|
||||
.step(#[allow(unused_braces)] { 1 });
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&SimpleCounter,
|
||||
props,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::IntoView::into_view(
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
::leptos::component_view(
|
||||
&ExternalComponent,
|
||||
::leptos::component_props_builder(&ExternalComponent).build(),
|
||||
)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&ExternalComponent);
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&ExternalComponent,
|
||||
props,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
.on(
|
||||
|
|
|
@ -1,66 +1,52 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -68,16 +54,19 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Ident {
|
||||
sym: initial_value,
|
||||
|
@ -89,22 +78,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -114,12 +108,15 @@ TokenStream [
|
|||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Ident {
|
||||
sym: step,
|
||||
|
@ -131,22 +128,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -156,20 +158,231 @@ TokenStream [
|
|||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,40 +1,50 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: IntoView,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: into_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -42,84 +52,74 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -127,29 +127,242 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
|
@ -157,6 +370,7 @@ TokenStream [
|
|||
},
|
||||
Ident {
|
||||
sym: on,
|
||||
span: bytes(29..50),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +1,25 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let _ = ::leptos::leptos_dom::html::div;
|
||||
::leptos::leptos_dom::html::div()
|
||||
.child(
|
||||
({
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let _ = ::leptos::leptos_dom::html::button;
|
||||
::leptos::leptos_dom::html::button()
|
||||
.on(::leptos::ev::click, move |_| set_value(0))
|
||||
.child("Clear")
|
||||
}),
|
||||
},
|
||||
)
|
||||
.child(
|
||||
({
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let _ = ::leptos::leptos_dom::html::button;
|
||||
::leptos::leptos_dom::html::button()
|
||||
.on(
|
||||
|
@ -23,19 +27,21 @@ fn view() {
|
|||
move |_| set_value.update(|value| *value -= step),
|
||||
)
|
||||
.child("-1")
|
||||
}),
|
||||
},
|
||||
)
|
||||
.child(
|
||||
({
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let _ = ::leptos::leptos_dom::html::span;
|
||||
::leptos::leptos_dom::html::span()
|
||||
.child("Value: ")
|
||||
.child(({ value }))
|
||||
.child({ value })
|
||||
.child("!")
|
||||
}),
|
||||
},
|
||||
)
|
||||
.child(
|
||||
({
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let _ = ::leptos::leptos_dom::html::button;
|
||||
::leptos::leptos_dom::html::button()
|
||||
.on(
|
||||
|
@ -43,7 +49,7 @@ fn view() {
|
|||
move |_| set_value.update(|value| *value += step),
|
||||
)
|
||||
.child("+1")
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::component_view(
|
||||
&SimpleCounter,
|
||||
::leptos::component_props_builder(&SimpleCounter)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&SimpleCounter)
|
||||
.initial_value(#[allow(unused_braces)] { 0 })
|
||||
.step(#[allow(unused_braces)] { 1 })
|
||||
.build(),
|
||||
)
|
||||
.step(#[allow(unused_braces)] { 1 });
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&SimpleCounter,
|
||||
props,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
::leptos::IntoView::into_view(
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
::leptos::component_view(
|
||||
&ExternalComponent,
|
||||
::leptos::component_props_builder(&ExternalComponent).build(),
|
||||
)
|
||||
{
|
||||
let props = ::leptos::component_props_builder(&ExternalComponent);
|
||||
#[allow(clippy::let_unit_value, clippy::unit_arg)]
|
||||
let props = props.build();
|
||||
#[allow(unreachable_code)]
|
||||
::leptos::component_view(
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
&ExternalComponent,
|
||||
props,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
.on(
|
||||
|
|
|
@ -1,66 +1,52 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -68,16 +54,19 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Ident {
|
||||
sym: initial_value,
|
||||
|
@ -89,22 +78,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -114,12 +108,15 @@ TokenStream [
|
|||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(51..52),
|
||||
},
|
||||
],
|
||||
span: bytes(37..52),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Ident {
|
||||
sym: step,
|
||||
|
@ -131,22 +128,27 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
|
@ -156,20 +158,231 @@ TokenStream [
|
|||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(70..71),
|
||||
},
|
||||
],
|
||||
span: bytes(65..71),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Ident {
|
||||
sym: SimpleCounter,
|
||||
span: bytes(11..24),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,40 +1,50 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: IntoView,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: into_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -42,84 +52,74 @@ TokenStream [
|
|||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: component_props_builder,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
@ -127,29 +127,242 @@ TokenStream [
|
|||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let_unit_value,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: unit_arg,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: let,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '=',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: build,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ';',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unreachable_code,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: leptos,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: component_view,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: clippy,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Joint,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: ':',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: needless_borrows_for_generic_args,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '&',
|
||||
spacing: Alone,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Ident {
|
||||
sym: ExternalComponent,
|
||||
span: bytes(11..28),
|
||||
},
|
||||
Punct {
|
||||
char: ',',
|
||||
spacing: Alone,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Ident {
|
||||
sym: props,
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
],
|
||||
span: bytes(10..82),
|
||||
},
|
||||
Punct {
|
||||
char: '.',
|
||||
|
@ -157,6 +370,7 @@ TokenStream [
|
|||
},
|
||||
Ident {
|
||||
sym: on,
|
||||
span: bytes(29..50),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: result
|
||||
---
|
||||
TokenStream [
|
||||
|
@ -1877,40 +1878,15 @@ TokenStream [
|
|||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
char: '#',
|
||||
spacing: Alone,
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: allow,
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: unused_braces,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
sym: value,
|
||||
span: bytes(206..211),
|
||||
},
|
||||
],
|
||||
span: bytes(205..212),
|
||||
Ident {
|
||||
sym: value,
|
||||
span: bytes(206..211),
|
||||
},
|
||||
],
|
||||
span: bytes(205..212),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: leptos_macro/src/view/tests.rs
|
||||
assertion_line: 101
|
||||
expression: pretty(result)
|
||||
---
|
||||
fn view() {
|
||||
|
@ -46,10 +47,7 @@ fn view() {
|
|||
),
|
||||
#[allow(unused_braces)]
|
||||
{
|
||||
let view = ::leptos::IntoView::into_view(
|
||||
#[allow(unused_braces)]
|
||||
{ { value } },
|
||||
);
|
||||
let view = ::leptos::IntoView::into_view({ value });
|
||||
::leptos::leptos_dom::html::StringOrView::View(
|
||||
::std::rc::Rc::new(move || view.clone()),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue