From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/syn/src/gen/visit.rs | 1413 +++++++++++++++++-------------------------- 1 file changed, 564 insertions(+), 849 deletions(-) (limited to 'vendor/syn/src/gen/visit.rs') diff --git a/vendor/syn/src/gen/visit.rs b/vendor/syn/src/gen/visit.rs index 19ddd2e72..9eaa24f05 100644 --- a/vendor/syn/src/gen/visit.rs +++ b/vendor/syn/src/gen/visit.rs @@ -3,8 +3,6 @@ #![allow(unused_variables)] #[cfg(any(feature = "full", feature = "derive"))] -use crate::gen::helper::visit::*; -#[cfg(any(feature = "full", feature = "derive"))] use crate::punctuated::Punctuated; use crate::*; use proc_macro2::Span; @@ -28,8 +26,6 @@ macro_rules! skip { /// See the [module documentation] for details. /// /// [module documentation]: self -/// -/// *This trait is available only if Syn is built with the `"visit"` feature.* pub trait Visit<'ast> { #[cfg(any(feature = "derive", feature = "full"))] fn visit_abi(&mut self, i: &'ast Abi) { @@ -47,6 +43,14 @@ pub trait Visit<'ast> { visit_arm(self, i); } #[cfg(any(feature = "derive", feature = "full"))] + fn visit_assoc_const(&mut self, i: &'ast AssocConst) { + visit_assoc_const(self, i); + } + #[cfg(any(feature = "derive", feature = "full"))] + fn visit_assoc_type(&mut self, i: &'ast AssocType) { + visit_assoc_type(self, i); + } + #[cfg(any(feature = "derive", feature = "full"))] fn visit_attr_style(&mut self, i: &'ast AttrStyle) { visit_attr_style(self, i); } @@ -59,12 +63,12 @@ pub trait Visit<'ast> { visit_bare_fn_arg(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_bin_op(&mut self, i: &'ast BinOp) { - visit_bin_op(self, i); + fn visit_bare_variadic(&mut self, i: &'ast BareVariadic) { + visit_bare_variadic(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_binding(&mut self, i: &'ast Binding) { - visit_binding(self, i); + fn visit_bin_op(&mut self, i: &'ast BinOp) { + visit_bin_op(self, i); } #[cfg(feature = "full")] fn visit_block(&mut self, i: &'ast Block) { @@ -115,10 +119,6 @@ pub trait Visit<'ast> { visit_expr_assign(self, i); } #[cfg(feature = "full")] - fn visit_expr_assign_op(&mut self, i: &'ast ExprAssignOp) { - visit_expr_assign_op(self, i); - } - #[cfg(feature = "full")] fn visit_expr_async(&mut self, i: &'ast ExprAsync) { visit_expr_async(self, i); } @@ -135,10 +135,6 @@ pub trait Visit<'ast> { visit_expr_block(self, i); } #[cfg(feature = "full")] - fn visit_expr_box(&mut self, i: &'ast ExprBox) { - visit_expr_box(self, i); - } - #[cfg(feature = "full")] fn visit_expr_break(&mut self, i: &'ast ExprBreak) { visit_expr_break(self, i); } @@ -155,6 +151,10 @@ pub trait Visit<'ast> { visit_expr_closure(self, i); } #[cfg(feature = "full")] + fn visit_expr_const(&mut self, i: &'ast ExprConst) { + visit_expr_const(self, i); + } + #[cfg(feature = "full")] fn visit_expr_continue(&mut self, i: &'ast ExprContinue) { visit_expr_continue(self, i); } @@ -166,7 +166,7 @@ pub trait Visit<'ast> { fn visit_expr_for_loop(&mut self, i: &'ast ExprForLoop) { visit_expr_for_loop(self, i); } - #[cfg(feature = "full")] + #[cfg(any(feature = "derive", feature = "full"))] fn visit_expr_group(&mut self, i: &'ast ExprGroup) { visit_expr_group(self, i); } @@ -179,6 +179,10 @@ pub trait Visit<'ast> { visit_expr_index(self, i); } #[cfg(feature = "full")] + fn visit_expr_infer(&mut self, i: &'ast ExprInfer) { + visit_expr_infer(self, i); + } + #[cfg(feature = "full")] fn visit_expr_let(&mut self, i: &'ast ExprLet) { visit_expr_let(self, i); } @@ -190,7 +194,7 @@ pub trait Visit<'ast> { fn visit_expr_loop(&mut self, i: &'ast ExprLoop) { visit_expr_loop(self, i); } - #[cfg(feature = "full")] + #[cfg(any(feature = "derive", feature = "full"))] fn visit_expr_macro(&mut self, i: &'ast ExprMacro) { visit_expr_macro(self, i); } @@ -242,10 +246,6 @@ pub trait Visit<'ast> { fn visit_expr_tuple(&mut self, i: &'ast ExprTuple) { visit_expr_tuple(self, i); } - #[cfg(feature = "full")] - fn visit_expr_type(&mut self, i: &'ast ExprType) { - visit_expr_type(self, i); - } #[cfg(any(feature = "derive", feature = "full"))] fn visit_expr_unary(&mut self, i: &'ast ExprUnary) { visit_expr_unary(self, i); @@ -266,6 +266,10 @@ pub trait Visit<'ast> { fn visit_field(&mut self, i: &'ast Field) { visit_field(self, i); } + #[cfg(any(feature = "derive", feature = "full"))] + fn visit_field_mutability(&mut self, i: &'ast FieldMutability) { + visit_field_mutability(self, i); + } #[cfg(feature = "full")] fn visit_field_pat(&mut self, i: &'ast FieldPat) { visit_field_pat(self, i); @@ -318,10 +322,6 @@ pub trait Visit<'ast> { fn visit_generic_argument(&mut self, i: &'ast GenericArgument) { visit_generic_argument(self, i); } - #[cfg(feature = "full")] - fn visit_generic_method_argument(&mut self, i: &'ast GenericMethodArgument) { - visit_generic_method_argument(self, i); - } #[cfg(any(feature = "derive", feature = "full"))] fn visit_generic_param(&mut self, i: &'ast GenericParam) { visit_generic_param(self, i); @@ -342,17 +342,21 @@ pub trait Visit<'ast> { visit_impl_item_const(self, i); } #[cfg(feature = "full")] - fn visit_impl_item_macro(&mut self, i: &'ast ImplItemMacro) { - visit_impl_item_macro(self, i); + fn visit_impl_item_fn(&mut self, i: &'ast ImplItemFn) { + visit_impl_item_fn(self, i); } #[cfg(feature = "full")] - fn visit_impl_item_method(&mut self, i: &'ast ImplItemMethod) { - visit_impl_item_method(self, i); + fn visit_impl_item_macro(&mut self, i: &'ast ImplItemMacro) { + visit_impl_item_macro(self, i); } #[cfg(feature = "full")] fn visit_impl_item_type(&mut self, i: &'ast ImplItemType) { visit_impl_item_type(self, i); } + #[cfg(feature = "full")] + fn visit_impl_restriction(&mut self, i: &'ast ImplRestriction) { + visit_impl_restriction(self, i); + } #[cfg(any(feature = "derive", feature = "full"))] fn visit_index(&mut self, i: &'ast Index) { visit_index(self, i); @@ -390,10 +394,6 @@ pub trait Visit<'ast> { visit_item_macro(self, i); } #[cfg(feature = "full")] - fn visit_item_macro2(&mut self, i: &'ast ItemMacro2) { - visit_item_macro2(self, i); - } - #[cfg(feature = "full")] fn visit_item_mod(&mut self, i: &'ast ItemMod) { visit_item_mod(self, i); } @@ -433,8 +433,8 @@ pub trait Visit<'ast> { visit_lifetime(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_lifetime_def(&mut self, i: &'ast LifetimeDef) { - visit_lifetime_def(self, i); + fn visit_lifetime_param(&mut self, i: &'ast LifetimeParam) { + visit_lifetime_param(self, i); } fn visit_lit(&mut self, i: &'ast Lit) { visit_lit(self, i); @@ -464,6 +464,10 @@ pub trait Visit<'ast> { fn visit_local(&mut self, i: &'ast Local) { visit_local(self, i); } + #[cfg(feature = "full")] + fn visit_local_init(&mut self, i: &'ast LocalInit) { + visit_local_init(self, i); + } #[cfg(any(feature = "derive", feature = "full"))] fn visit_macro(&mut self, i: &'ast Macro) { visit_macro(self, i); @@ -488,14 +492,6 @@ pub trait Visit<'ast> { fn visit_meta_name_value(&mut self, i: &'ast MetaNameValue) { visit_meta_name_value(self, i); } - #[cfg(feature = "full")] - fn visit_method_turbofish(&mut self, i: &'ast MethodTurbofish) { - visit_method_turbofish(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] - fn visit_nested_meta(&mut self, i: &'ast NestedMeta) { - visit_nested_meta(self, i); - } #[cfg(any(feature = "derive", feature = "full"))] fn visit_parenthesized_generic_arguments( &mut self, @@ -508,32 +504,16 @@ pub trait Visit<'ast> { visit_pat(self, i); } #[cfg(feature = "full")] - fn visit_pat_box(&mut self, i: &'ast PatBox) { - visit_pat_box(self, i); - } - #[cfg(feature = "full")] fn visit_pat_ident(&mut self, i: &'ast PatIdent) { visit_pat_ident(self, i); } #[cfg(feature = "full")] - fn visit_pat_lit(&mut self, i: &'ast PatLit) { - visit_pat_lit(self, i); - } - #[cfg(feature = "full")] - fn visit_pat_macro(&mut self, i: &'ast PatMacro) { - visit_pat_macro(self, i); - } - #[cfg(feature = "full")] fn visit_pat_or(&mut self, i: &'ast PatOr) { visit_pat_or(self, i); } #[cfg(feature = "full")] - fn visit_pat_path(&mut self, i: &'ast PatPath) { - visit_pat_path(self, i); - } - #[cfg(feature = "full")] - fn visit_pat_range(&mut self, i: &'ast PatRange) { - visit_pat_range(self, i); + fn visit_pat_paren(&mut self, i: &'ast PatParen) { + visit_pat_paren(self, i); } #[cfg(feature = "full")] fn visit_pat_reference(&mut self, i: &'ast PatReference) { @@ -580,10 +560,6 @@ pub trait Visit<'ast> { visit_path_segment(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_predicate_eq(&mut self, i: &'ast PredicateEq) { - visit_predicate_eq(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] fn visit_predicate_lifetime(&mut self, i: &'ast PredicateLifetime) { visit_predicate_lifetime(self, i); } @@ -615,9 +591,17 @@ pub trait Visit<'ast> { visit_span(self, i); } #[cfg(feature = "full")] + fn visit_static_mutability(&mut self, i: &'ast StaticMutability) { + visit_static_mutability(self, i); + } + #[cfg(feature = "full")] fn visit_stmt(&mut self, i: &'ast Stmt) { visit_stmt(self, i); } + #[cfg(feature = "full")] + fn visit_stmt_macro(&mut self, i: &'ast StmtMacro) { + visit_stmt_macro(self, i); + } #[cfg(any(feature = "derive", feature = "full"))] fn visit_trait_bound(&mut self, i: &'ast TraitBound) { visit_trait_bound(self, i); @@ -635,12 +619,12 @@ pub trait Visit<'ast> { visit_trait_item_const(self, i); } #[cfg(feature = "full")] - fn visit_trait_item_macro(&mut self, i: &'ast TraitItemMacro) { - visit_trait_item_macro(self, i); + fn visit_trait_item_fn(&mut self, i: &'ast TraitItemFn) { + visit_trait_item_fn(self, i); } #[cfg(feature = "full")] - fn visit_trait_item_method(&mut self, i: &'ast TraitItemMethod) { - visit_trait_item_method(self, i); + fn visit_trait_item_macro(&mut self, i: &'ast TraitItemMacro) { + visit_trait_item_macro(self, i); } #[cfg(feature = "full")] fn visit_trait_item_type(&mut self, i: &'ast TraitItemType) { @@ -742,7 +726,7 @@ pub trait Visit<'ast> { fn visit_use_tree(&mut self, i: &'ast UseTree) { visit_use_tree(self, i); } - #[cfg(any(feature = "derive", feature = "full"))] + #[cfg(feature = "full")] fn visit_variadic(&mut self, i: &'ast Variadic) { visit_variadic(self, i); } @@ -751,14 +735,6 @@ pub trait Visit<'ast> { visit_variant(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_vis_crate(&mut self, i: &'ast VisCrate) { - visit_vis_crate(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] - fn visit_vis_public(&mut self, i: &'ast VisPublic) { - visit_vis_public(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] fn visit_vis_restricted(&mut self, i: &'ast VisRestricted) { visit_vis_restricted(self, i); } @@ -780,7 +756,7 @@ pub fn visit_abi<'ast, V>(v: &mut V, node: &'ast Abi) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.extern_token.span); + skip!(node.extern_token); if let Some(it) = &node.name { v.visit_lit_str(it); } @@ -793,18 +769,13 @@ pub fn visit_angle_bracketed_generic_arguments<'ast, V>( where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.colon2_token { - tokens_helper(v, &it.spans); - } - tokens_helper(v, &node.lt_token.spans); + skip!(node.colon2_token); + skip!(node.lt_token); for el in Punctuated::pairs(&node.args) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_generic_argument(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } - tokens_helper(v, &node.gt_token.spans); + skip!(node.gt_token); } #[cfg(feature = "full")] pub fn visit_arm<'ast, V>(v: &mut V, node: &'ast Arm) @@ -816,14 +787,36 @@ where } v.visit_pat(&node.pat); if let Some(it) = &node.guard { - tokens_helper(v, &(it).0.span); + skip!((it).0); v.visit_expr(&*(it).1); } - tokens_helper(v, &node.fat_arrow_token.spans); + skip!(node.fat_arrow_token); v.visit_expr(&*node.body); - if let Some(it) = &node.comma { - tokens_helper(v, &it.spans); + skip!(node.comma); +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn visit_assoc_const<'ast, V>(v: &mut V, node: &'ast AssocConst) +where + V: Visit<'ast> + ?Sized, +{ + v.visit_ident(&node.ident); + if let Some(it) = &node.generics { + v.visit_angle_bracketed_generic_arguments(it); } + skip!(node.eq_token); + v.visit_expr(&node.value); +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn visit_assoc_type<'ast, V>(v: &mut V, node: &'ast AssocType) +where + V: Visit<'ast> + ?Sized, +{ + v.visit_ident(&node.ident); + if let Some(it) = &node.generics { + v.visit_angle_bracketed_generic_arguments(it); + } + skip!(node.eq_token); + v.visit_type(&node.ty); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_attr_style<'ast, V>(v: &mut V, node: &'ast AttrStyle) @@ -833,7 +826,7 @@ where match node { AttrStyle::Outer => {} AttrStyle::Inner(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } } } @@ -842,11 +835,10 @@ pub fn visit_attribute<'ast, V>(v: &mut V, node: &'ast Attribute) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.pound_token.spans); + skip!(node.pound_token); v.visit_attr_style(&node.style); - tokens_helper(v, &node.bracket_token.span); - v.visit_path(&node.path); - skip!(node.tokens); + skip!(node.bracket_token); + v.visit_meta(&node.meta); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_bare_fn_arg<'ast, V>(v: &mut V, node: &'ast BareFnArg) @@ -858,117 +850,123 @@ where } if let Some(it) = &node.name { v.visit_ident(&(it).0); - tokens_helper(v, &(it).1.spans); + skip!((it).1); } v.visit_type(&node.ty); } #[cfg(any(feature = "derive", feature = "full"))] +pub fn visit_bare_variadic<'ast, V>(v: &mut V, node: &'ast BareVariadic) +where + V: Visit<'ast> + ?Sized, +{ + for it in &node.attrs { + v.visit_attribute(it); + } + if let Some(it) = &node.name { + v.visit_ident(&(it).0); + skip!((it).1); + } + skip!(node.dots); + skip!(node.comma); +} +#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_bin_op<'ast, V>(v: &mut V, node: &'ast BinOp) where V: Visit<'ast> + ?Sized, { match node { BinOp::Add(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Sub(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Mul(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Div(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Rem(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::And(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Or(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::BitXor(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::BitAnd(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::BitOr(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Shl(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Shr(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Eq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Lt(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Le(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Ne(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Ge(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } BinOp::Gt(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } - BinOp::AddEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::AddAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::SubEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::SubAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::MulEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::MulAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::DivEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::DivAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::RemEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::RemAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::BitXorEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::BitXorAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::BitAndEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::BitAndAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::BitOrEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::BitOrAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::ShlEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::ShlAssign(_binding_0) => { + skip!(_binding_0); } - BinOp::ShrEq(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + BinOp::ShrAssign(_binding_0) => { + skip!(_binding_0); } } } -#[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_binding<'ast, V>(v: &mut V, node: &'ast Binding) -where - V: Visit<'ast> + ?Sized, -{ - v.visit_ident(&node.ident); - tokens_helper(v, &node.eq_token.spans); - v.visit_type(&node.ty); -} #[cfg(feature = "full")] pub fn visit_block<'ast, V>(v: &mut V, node: &'ast Block) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for it in &node.stmts { v.visit_stmt(it); } @@ -978,16 +976,13 @@ pub fn visit_bound_lifetimes<'ast, V>(v: &mut V, node: &'ast BoundLifetimes) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.for_token.span); - tokens_helper(v, &node.lt_token.spans); + skip!(node.for_token); + skip!(node.lt_token); for el in Punctuated::pairs(&node.lifetimes) { - let (it, p) = el.into_tuple(); - v.visit_lifetime_def(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } + let it = el.value(); + v.visit_generic_param(it); } - tokens_helper(v, &node.gt_token.spans); + skip!(node.gt_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_const_param<'ast, V>(v: &mut V, node: &'ast ConstParam) @@ -997,13 +992,11 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.const_token.span); + skip!(node.const_token); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); v.visit_type(&node.ty); - if let Some(it) = &node.eq_token { - tokens_helper(v, &it.spans); - } + skip!(node.eq_token); if let Some(it) = &node.default { v.visit_expr(it); } @@ -1014,13 +1007,13 @@ where V: Visit<'ast> + ?Sized, { v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + if let Some(it) = &node.generics { + v.visit_angle_bracketed_generic_arguments(it); + } + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "derive")] @@ -1045,14 +1038,11 @@ pub fn visit_data_enum<'ast, V>(v: &mut V, node: &'ast DataEnum) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.enum_token.span); - tokens_helper(v, &node.brace_token.span); + skip!(node.enum_token); + skip!(node.brace_token); for el in Punctuated::pairs(&node.variants) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_variant(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "derive")] @@ -1060,18 +1050,16 @@ pub fn visit_data_struct<'ast, V>(v: &mut V, node: &'ast DataStruct) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.struct_token.span); + skip!(node.struct_token); v.visit_fields(&node.fields); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } + skip!(node.semi_token); } #[cfg(feature = "derive")] pub fn visit_data_union<'ast, V>(v: &mut V, node: &'ast DataUnion) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.union_token.span); + skip!(node.union_token); v.visit_fields_named(&node.fields); } #[cfg(feature = "derive")] @@ -1099,9 +1087,6 @@ where Expr::Assign(_binding_0) => { full!(v.visit_expr_assign(_binding_0)); } - Expr::AssignOp(_binding_0) => { - full!(v.visit_expr_assign_op(_binding_0)); - } Expr::Async(_binding_0) => { full!(v.visit_expr_async(_binding_0)); } @@ -1114,9 +1099,6 @@ where Expr::Block(_binding_0) => { full!(v.visit_expr_block(_binding_0)); } - Expr::Box(_binding_0) => { - full!(v.visit_expr_box(_binding_0)); - } Expr::Break(_binding_0) => { full!(v.visit_expr_break(_binding_0)); } @@ -1129,6 +1111,9 @@ where Expr::Closure(_binding_0) => { full!(v.visit_expr_closure(_binding_0)); } + Expr::Const(_binding_0) => { + full!(v.visit_expr_const(_binding_0)); + } Expr::Continue(_binding_0) => { full!(v.visit_expr_continue(_binding_0)); } @@ -1139,7 +1124,7 @@ where full!(v.visit_expr_for_loop(_binding_0)); } Expr::Group(_binding_0) => { - full!(v.visit_expr_group(_binding_0)); + v.visit_expr_group(_binding_0); } Expr::If(_binding_0) => { full!(v.visit_expr_if(_binding_0)); @@ -1147,6 +1132,9 @@ where Expr::Index(_binding_0) => { v.visit_expr_index(_binding_0); } + Expr::Infer(_binding_0) => { + full!(v.visit_expr_infer(_binding_0)); + } Expr::Let(_binding_0) => { full!(v.visit_expr_let(_binding_0)); } @@ -1157,7 +1145,7 @@ where full!(v.visit_expr_loop(_binding_0)); } Expr::Macro(_binding_0) => { - full!(v.visit_expr_macro(_binding_0)); + v.visit_expr_macro(_binding_0); } Expr::Match(_binding_0) => { full!(v.visit_expr_match(_binding_0)); @@ -1195,9 +1183,6 @@ where Expr::Tuple(_binding_0) => { full!(v.visit_expr_tuple(_binding_0)); } - Expr::Type(_binding_0) => { - full!(v.visit_expr_type(_binding_0)); - } Expr::Unary(_binding_0) => { v.visit_expr_unary(_binding_0); } @@ -1213,8 +1198,6 @@ where Expr::Yield(_binding_0) => { full!(v.visit_expr_yield(_binding_0)); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] @@ -1225,13 +1208,10 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); for el in Punctuated::pairs(&node.elems) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_expr(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -1243,19 +1223,7 @@ where v.visit_attribute(it); } v.visit_expr(&*node.left); - tokens_helper(v, &node.eq_token.spans); - v.visit_expr(&*node.right); -} -#[cfg(feature = "full")] -pub fn visit_expr_assign_op<'ast, V>(v: &mut V, node: &'ast ExprAssignOp) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - v.visit_expr(&*node.left); - v.visit_bin_op(&node.op); + skip!(node.eq_token); v.visit_expr(&*node.right); } #[cfg(feature = "full")] @@ -1266,10 +1234,8 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.async_token.span); - if let Some(it) = &node.capture { - tokens_helper(v, &it.span); - } + skip!(node.async_token); + skip!(node.capture); v.visit_block(&node.block); } #[cfg(feature = "full")] @@ -1281,8 +1247,8 @@ where v.visit_attribute(it); } v.visit_expr(&*node.base); - tokens_helper(v, &node.dot_token.spans); - tokens_helper(v, &node.await_token.span); + skip!(node.dot_token); + skip!(node.await_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_expr_binary<'ast, V>(v: &mut V, node: &'ast ExprBinary) @@ -1310,17 +1276,6 @@ where v.visit_block(&node.block); } #[cfg(feature = "full")] -pub fn visit_expr_box<'ast, V>(v: &mut V, node: &'ast ExprBox) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - tokens_helper(v, &node.box_token.span); - v.visit_expr(&*node.expr); -} -#[cfg(feature = "full")] pub fn visit_expr_break<'ast, V>(v: &mut V, node: &'ast ExprBreak) where V: Visit<'ast> + ?Sized, @@ -1328,7 +1283,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.break_token.span); + skip!(node.break_token); if let Some(it) = &node.label { v.visit_lifetime(it); } @@ -1345,13 +1300,10 @@ where v.visit_attribute(it); } v.visit_expr(&*node.func); - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.args) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_expr(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -1363,7 +1315,7 @@ where v.visit_attribute(it); } v.visit_expr(&*node.expr); - tokens_helper(v, &node.as_token.span); + skip!(node.as_token); v.visit_type(&*node.ty); } #[cfg(feature = "full")] @@ -1374,28 +1326,34 @@ where for it in &node.attrs { v.visit_attribute(it); } - if let Some(it) = &node.movability { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.asyncness { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.capture { - tokens_helper(v, &it.span); + if let Some(it) = &node.lifetimes { + v.visit_bound_lifetimes(it); } - tokens_helper(v, &node.or1_token.spans); + skip!(node.constness); + skip!(node.movability); + skip!(node.asyncness); + skip!(node.capture); + skip!(node.or1_token); for el in Punctuated::pairs(&node.inputs) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_pat(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } - tokens_helper(v, &node.or2_token.spans); + skip!(node.or2_token); v.visit_return_type(&node.output); v.visit_expr(&*node.body); } #[cfg(feature = "full")] +pub fn visit_expr_const<'ast, V>(v: &mut V, node: &'ast ExprConst) +where + V: Visit<'ast> + ?Sized, +{ + for it in &node.attrs { + v.visit_attribute(it); + } + skip!(node.const_token); + v.visit_block(&node.block); +} +#[cfg(feature = "full")] pub fn visit_expr_continue<'ast, V>(v: &mut V, node: &'ast ExprContinue) where V: Visit<'ast> + ?Sized, @@ -1403,7 +1361,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.continue_token.span); + skip!(node.continue_token); if let Some(it) = &node.label { v.visit_lifetime(it); } @@ -1417,7 +1375,7 @@ where v.visit_attribute(it); } v.visit_expr(&*node.base); - tokens_helper(v, &node.dot_token.spans); + skip!(node.dot_token); v.visit_member(&node.member); } #[cfg(feature = "full")] @@ -1431,13 +1389,13 @@ where if let Some(it) = &node.label { v.visit_label(it); } - tokens_helper(v, &node.for_token.span); - v.visit_pat(&node.pat); - tokens_helper(v, &node.in_token.span); + skip!(node.for_token); + v.visit_pat(&*node.pat); + skip!(node.in_token); v.visit_expr(&*node.expr); v.visit_block(&node.body); } -#[cfg(feature = "full")] +#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_expr_group<'ast, V>(v: &mut V, node: &'ast ExprGroup) where V: Visit<'ast> + ?Sized, @@ -1445,7 +1403,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.group_token.span); + skip!(node.group_token); v.visit_expr(&*node.expr); } #[cfg(feature = "full")] @@ -1456,11 +1414,11 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.if_token.span); + skip!(node.if_token); v.visit_expr(&*node.cond); v.visit_block(&node.then_branch); if let Some(it) = &node.else_branch { - tokens_helper(v, &(it).0.span); + skip!((it).0); v.visit_expr(&*(it).1); } } @@ -1473,10 +1431,20 @@ where v.visit_attribute(it); } v.visit_expr(&*node.expr); - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); v.visit_expr(&*node.index); } #[cfg(feature = "full")] +pub fn visit_expr_infer<'ast, V>(v: &mut V, node: &'ast ExprInfer) +where + V: Visit<'ast> + ?Sized, +{ + for it in &node.attrs { + v.visit_attribute(it); + } + skip!(node.underscore_token); +} +#[cfg(feature = "full")] pub fn visit_expr_let<'ast, V>(v: &mut V, node: &'ast ExprLet) where V: Visit<'ast> + ?Sized, @@ -1484,9 +1452,9 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.let_token.span); - v.visit_pat(&node.pat); - tokens_helper(v, &node.eq_token.spans); + skip!(node.let_token); + v.visit_pat(&*node.pat); + skip!(node.eq_token); v.visit_expr(&*node.expr); } #[cfg(any(feature = "derive", feature = "full"))] @@ -1510,10 +1478,10 @@ where if let Some(it) = &node.label { v.visit_label(it); } - tokens_helper(v, &node.loop_token.span); + skip!(node.loop_token); v.visit_block(&node.body); } -#[cfg(feature = "full")] +#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_expr_macro<'ast, V>(v: &mut V, node: &'ast ExprMacro) where V: Visit<'ast> + ?Sized, @@ -1531,9 +1499,9 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.match_token.span); + skip!(node.match_token); v.visit_expr(&*node.expr); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for it in &node.arms { v.visit_arm(it); } @@ -1547,18 +1515,15 @@ where v.visit_attribute(it); } v.visit_expr(&*node.receiver); - tokens_helper(v, &node.dot_token.spans); + skip!(node.dot_token); v.visit_ident(&node.method); if let Some(it) = &node.turbofish { - v.visit_method_turbofish(it); + v.visit_angle_bracketed_generic_arguments(it); } - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.args) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_expr(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -1569,7 +1534,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); v.visit_expr(&*node.expr); } #[cfg(any(feature = "derive", feature = "full"))] @@ -1593,11 +1558,11 @@ where for it in &node.attrs { v.visit_attribute(it); } - if let Some(it) = &node.from { + if let Some(it) = &node.start { v.visit_expr(&**it); } v.visit_range_limits(&node.limits); - if let Some(it) = &node.to { + if let Some(it) = &node.end { v.visit_expr(&**it); } } @@ -1609,10 +1574,8 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.and_token.spans); - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.and_token); + skip!(node.mutability); v.visit_expr(&*node.expr); } #[cfg(feature = "full")] @@ -1623,9 +1586,9 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); v.visit_expr(&*node.expr); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); v.visit_expr(&*node.len); } #[cfg(feature = "full")] @@ -1636,7 +1599,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.return_token.span); + skip!(node.return_token); if let Some(it) = &node.expr { v.visit_expr(&**it); } @@ -1649,18 +1612,16 @@ where for it in &node.attrs { v.visit_attribute(it); } + if let Some(it) = &node.qself { + v.visit_qself(it); + } v.visit_path(&node.path); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for el in Punctuated::pairs(&node.fields) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_field_value(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } - if let Some(it) = &node.dot2_token { - tokens_helper(v, &it.spans); } + skip!(node.dot2_token); if let Some(it) = &node.rest { v.visit_expr(&**it); } @@ -1674,7 +1635,7 @@ where v.visit_attribute(it); } v.visit_expr(&*node.expr); - tokens_helper(v, &node.question_token.spans); + skip!(node.question_token); } #[cfg(feature = "full")] pub fn visit_expr_try_block<'ast, V>(v: &mut V, node: &'ast ExprTryBlock) @@ -1684,7 +1645,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.try_token.span); + skip!(node.try_token); v.visit_block(&node.block); } #[cfg(feature = "full")] @@ -1695,27 +1656,12 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.elems) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_expr(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } -#[cfg(feature = "full")] -pub fn visit_expr_type<'ast, V>(v: &mut V, node: &'ast ExprType) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - v.visit_expr(&*node.expr); - tokens_helper(v, &node.colon_token.spans); - v.visit_type(&*node.ty); -} #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_expr_unary<'ast, V>(v: &mut V, node: &'ast ExprUnary) where @@ -1735,7 +1681,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.unsafe_token.span); + skip!(node.unsafe_token); v.visit_block(&node.block); } #[cfg(feature = "full")] @@ -1749,7 +1695,7 @@ where if let Some(it) = &node.label { v.visit_label(it); } - tokens_helper(v, &node.while_token.span); + skip!(node.while_token); v.visit_expr(&*node.cond); v.visit_block(&node.body); } @@ -1761,7 +1707,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.yield_token.span); + skip!(node.yield_token); if let Some(it) = &node.expr { v.visit_expr(&**it); } @@ -1775,14 +1721,22 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); + v.visit_field_mutability(&node.mutability); if let Some(it) = &node.ident { v.visit_ident(it); } - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); v.visit_type(&node.ty); } +#[cfg(any(feature = "derive", feature = "full"))] +pub fn visit_field_mutability<'ast, V>(v: &mut V, node: &'ast FieldMutability) +where + V: Visit<'ast> + ?Sized, +{ + match node { + FieldMutability::None => {} + } +} #[cfg(feature = "full")] pub fn visit_field_pat<'ast, V>(v: &mut V, node: &'ast FieldPat) where @@ -1792,9 +1746,7 @@ where v.visit_attribute(it); } v.visit_member(&node.member); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); v.visit_pat(&*node.pat); } #[cfg(feature = "full")] @@ -1806,9 +1758,7 @@ where v.visit_attribute(it); } v.visit_member(&node.member); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); v.visit_expr(&node.expr); } #[cfg(any(feature = "derive", feature = "full"))] @@ -1831,13 +1781,10 @@ pub fn visit_fields_named<'ast, V>(v: &mut V, node: &'ast FieldsNamed) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for el in Punctuated::pairs(&node.named) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_field(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -1845,13 +1792,10 @@ pub fn visit_fields_unnamed<'ast, V>(v: &mut V, node: &'ast FieldsUnnamed) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.unnamed) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_field(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -1902,8 +1846,6 @@ where ForeignItem::Verbatim(_binding_0) => { skip!(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] @@ -1916,7 +1858,7 @@ where } v.visit_visibility(&node.vis); v.visit_signature(&node.sig); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_foreign_item_macro<'ast, V>(v: &mut V, node: &'ast ForeignItemMacro) @@ -1927,9 +1869,7 @@ where v.visit_attribute(it); } v.visit_macro(&node.mac); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_foreign_item_static<'ast, V>(v: &mut V, node: &'ast ForeignItemStatic) @@ -1940,14 +1880,12 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.static_token.span); - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.static_token); + v.visit_static_mutability(&node.mutability); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); v.visit_type(&*node.ty); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_foreign_item_type<'ast, V>(v: &mut V, node: &'ast ForeignItemType) @@ -1958,9 +1896,10 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.type_token.span); + skip!(node.type_token); v.visit_ident(&node.ident); - tokens_helper(v, &node.semi_token.spans); + v.visit_generics(&node.generics); + skip!(node.semi_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_generic_argument<'ast, V>(v: &mut V, node: &'ast GenericArgument) @@ -1977,43 +1916,29 @@ where GenericArgument::Const(_binding_0) => { v.visit_expr(_binding_0); } - GenericArgument::Binding(_binding_0) => { - v.visit_binding(_binding_0); + GenericArgument::AssocType(_binding_0) => { + v.visit_assoc_type(_binding_0); + } + GenericArgument::AssocConst(_binding_0) => { + v.visit_assoc_const(_binding_0); } GenericArgument::Constraint(_binding_0) => { v.visit_constraint(_binding_0); } } } -#[cfg(feature = "full")] -pub fn visit_generic_method_argument<'ast, V>( - v: &mut V, - node: &'ast GenericMethodArgument, -) -where - V: Visit<'ast> + ?Sized, -{ - match node { - GenericMethodArgument::Type(_binding_0) => { - v.visit_type(_binding_0); - } - GenericMethodArgument::Const(_binding_0) => { - v.visit_expr(_binding_0); - } - } -} #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_generic_param<'ast, V>(v: &mut V, node: &'ast GenericParam) where V: Visit<'ast> + ?Sized, { match node { + GenericParam::Lifetime(_binding_0) => { + v.visit_lifetime_param(_binding_0); + } GenericParam::Type(_binding_0) => { v.visit_type_param(_binding_0); } - GenericParam::Lifetime(_binding_0) => { - v.visit_lifetime_def(_binding_0); - } GenericParam::Const(_binding_0) => { v.visit_const_param(_binding_0); } @@ -2024,19 +1949,12 @@ pub fn visit_generics<'ast, V>(v: &mut V, node: &'ast Generics) where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.lt_token { - tokens_helper(v, &it.spans); - } + skip!(node.lt_token); for el in Punctuated::pairs(&node.params) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_generic_param(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } - if let Some(it) = &node.gt_token { - tokens_helper(v, &it.spans); } + skip!(node.gt_token); if let Some(it) = &node.where_clause { v.visit_where_clause(it); } @@ -2056,8 +1974,8 @@ where ImplItem::Const(_binding_0) => { v.visit_impl_item_const(_binding_0); } - ImplItem::Method(_binding_0) => { - v.visit_impl_item_method(_binding_0); + ImplItem::Fn(_binding_0) => { + v.visit_impl_item_fn(_binding_0); } ImplItem::Type(_binding_0) => { v.visit_impl_item_type(_binding_0); @@ -2068,8 +1986,6 @@ where ImplItem::Verbatim(_binding_0) => { skip!(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] @@ -2081,44 +1997,39 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - if let Some(it) = &node.defaultness { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.const_token.span); + skip!(node.defaultness); + skip!(node.const_token); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + v.visit_generics(&node.generics); + skip!(node.colon_token); v.visit_type(&node.ty); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); v.visit_expr(&node.expr); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] -pub fn visit_impl_item_macro<'ast, V>(v: &mut V, node: &'ast ImplItemMacro) +pub fn visit_impl_item_fn<'ast, V>(v: &mut V, node: &'ast ImplItemFn) where V: Visit<'ast> + ?Sized, { for it in &node.attrs { v.visit_attribute(it); } - v.visit_macro(&node.mac); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } + v.visit_visibility(&node.vis); + skip!(node.defaultness); + v.visit_signature(&node.sig); + v.visit_block(&node.block); } #[cfg(feature = "full")] -pub fn visit_impl_item_method<'ast, V>(v: &mut V, node: &'ast ImplItemMethod) +pub fn visit_impl_item_macro<'ast, V>(v: &mut V, node: &'ast ImplItemMacro) where V: Visit<'ast> + ?Sized, { for it in &node.attrs { v.visit_attribute(it); } - v.visit_visibility(&node.vis); - if let Some(it) = &node.defaultness { - tokens_helper(v, &it.span); - } - v.visit_signature(&node.sig); - v.visit_block(&node.block); + v.visit_macro(&node.mac); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_impl_item_type<'ast, V>(v: &mut V, node: &'ast ImplItemType) @@ -2129,15 +2040,20 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - if let Some(it) = &node.defaultness { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.type_token.span); + skip!(node.defaultness); + skip!(node.type_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); v.visit_type(&node.ty); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); +} +#[cfg(feature = "full")] +pub fn visit_impl_restriction<'ast, V>(v: &mut V, node: &'ast ImplRestriction) +where + V: Visit<'ast> + ?Sized, +{ + match *node {} } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_index<'ast, V>(v: &mut V, node: &'ast Index) @@ -2174,9 +2090,6 @@ where Item::Macro(_binding_0) => { v.visit_item_macro(_binding_0); } - Item::Macro2(_binding_0) => { - v.visit_item_macro2(_binding_0); - } Item::Mod(_binding_0) => { v.visit_item_mod(_binding_0); } @@ -2204,8 +2117,6 @@ where Item::Verbatim(_binding_0) => { skip!(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] @@ -2217,13 +2128,14 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.const_token.span); + skip!(node.const_token); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + v.visit_generics(&node.generics); + skip!(node.colon_token); v.visit_type(&*node.ty); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); v.visit_expr(&*node.expr); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_enum<'ast, V>(v: &mut V, node: &'ast ItemEnum) @@ -2234,16 +2146,13 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.enum_token.span); + skip!(node.enum_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for el in Punctuated::pairs(&node.variants) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_variant(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -2255,14 +2164,14 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.extern_token.span); - tokens_helper(v, &node.crate_token.span); + skip!(node.extern_token); + skip!(node.crate_token); v.visit_ident(&node.ident); if let Some(it) = &node.rename { - tokens_helper(v, &(it).0.span); + skip!((it).0); v.visit_ident(&(it).1); } - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_fn<'ast, V>(v: &mut V, node: &'ast ItemFn) @@ -2284,8 +2193,9 @@ where for it in &node.attrs { v.visit_attribute(it); } + skip!(node.unsafety); v.visit_abi(&node.abi); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for it in &node.items { v.visit_foreign_item(it); } @@ -2298,23 +2208,17 @@ where for it in &node.attrs { v.visit_attribute(it); } - if let Some(it) = &node.defaultness { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.unsafety { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.impl_token.span); + skip!(node.defaultness); + skip!(node.unsafety); + skip!(node.impl_token); v.visit_generics(&node.generics); if let Some(it) = &node.trait_ { - if let Some(it) = &(it).0 { - tokens_helper(v, &it.spans); - } + skip!((it).0); v.visit_path(&(it).1); - tokens_helper(v, &(it).2.span); + skip!((it).2); } v.visit_type(&*node.self_ty); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for it in &node.items { v.visit_impl_item(it); } @@ -2331,22 +2235,7 @@ where v.visit_ident(it); } v.visit_macro(&node.mac); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } -} -#[cfg(feature = "full")] -pub fn visit_item_macro2<'ast, V>(v: &mut V, node: &'ast ItemMacro2) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - v.visit_visibility(&node.vis); - tokens_helper(v, &node.macro_token.span); - v.visit_ident(&node.ident); - skip!(node.rules); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_mod<'ast, V>(v: &mut V, node: &'ast ItemMod) @@ -2357,17 +2246,16 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.mod_token.span); + skip!(node.unsafety); + skip!(node.mod_token); v.visit_ident(&node.ident); if let Some(it) = &node.content { - tokens_helper(v, &(it).0.span); + skip!((it).0); for it in &(it).1 { v.visit_item(it); } } - if let Some(it) = &node.semi { - tokens_helper(v, &it.spans); - } + skip!(node.semi); } #[cfg(feature = "full")] pub fn visit_item_static<'ast, V>(v: &mut V, node: &'ast ItemStatic) @@ -2378,16 +2266,14 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.static_token.span); - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.static_token); + v.visit_static_mutability(&node.mutability); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); v.visit_type(&*node.ty); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); v.visit_expr(&*node.expr); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_struct<'ast, V>(v: &mut V, node: &'ast ItemStruct) @@ -2398,13 +2284,11 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.struct_token.span); + skip!(node.struct_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); v.visit_fields(&node.fields); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_trait<'ast, V>(v: &mut V, node: &'ast ItemTrait) @@ -2415,26 +2299,20 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - if let Some(it) = &node.unsafety { - tokens_helper(v, &it.span); + skip!(node.unsafety); + skip!(node.auto_token); + if let Some(it) = &node.restriction { + v.visit_impl_restriction(it); } - if let Some(it) = &node.auto_token { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.trait_token.span); + skip!(node.trait_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); for el in Punctuated::pairs(&node.supertraits) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for it in &node.items { v.visit_trait_item(it); } @@ -2448,18 +2326,15 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.trait_token.span); + skip!(node.trait_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_type<'ast, V>(v: &mut V, node: &'ast ItemType) @@ -2470,12 +2345,12 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.type_token.span); + skip!(node.type_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - tokens_helper(v, &node.eq_token.spans); + skip!(node.eq_token); v.visit_type(&*node.ty); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_item_union<'ast, V>(v: &mut V, node: &'ast ItemUnion) @@ -2486,7 +2361,7 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.union_token.span); + skip!(node.union_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); v.visit_fields_named(&node.fields); @@ -2500,12 +2375,10 @@ where v.visit_attribute(it); } v.visit_visibility(&node.vis); - tokens_helper(v, &node.use_token.span); - if let Some(it) = &node.leading_colon { - tokens_helper(v, &it.spans); - } + skip!(node.use_token); + skip!(node.leading_colon); v.visit_use_tree(&node.tree); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_label<'ast, V>(v: &mut V, node: &'ast Label) @@ -2513,7 +2386,7 @@ where V: Visit<'ast> + ?Sized, { v.visit_lifetime(&node.name); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); } pub fn visit_lifetime<'ast, V>(v: &mut V, node: &'ast Lifetime) where @@ -2523,7 +2396,7 @@ where v.visit_ident(&node.ident); } #[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_lifetime_def<'ast, V>(v: &mut V, node: &'ast LifetimeDef) +pub fn visit_lifetime_param<'ast, V>(v: &mut V, node: &'ast LifetimeParam) where V: Visit<'ast> + ?Sized, { @@ -2531,15 +2404,10 @@ where v.visit_attribute(it); } v.visit_lifetime(&node.lifetime); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_lifetime(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } pub fn visit_lit<'ast, V>(v: &mut V, node: &'ast Lit) @@ -2612,13 +2480,24 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.let_token.span); + skip!(node.let_token); v.visit_pat(&node.pat); if let Some(it) = &node.init { - tokens_helper(v, &(it).0.spans); + v.visit_local_init(it); + } + skip!(node.semi_token); +} +#[cfg(feature = "full")] +pub fn visit_local_init<'ast, V>(v: &mut V, node: &'ast LocalInit) +where + V: Visit<'ast> + ?Sized, +{ + skip!(node.eq_token); + v.visit_expr(&*node.expr); + if let Some(it) = &node.diverge { + skip!((it).0); v.visit_expr(&*(it).1); } - tokens_helper(v, &node.semi_token.spans); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_macro<'ast, V>(v: &mut V, node: &'ast Macro) @@ -2626,7 +2505,7 @@ where V: Visit<'ast> + ?Sized, { v.visit_path(&node.path); - tokens_helper(v, &node.bang_token.spans); + skip!(node.bang_token); v.visit_macro_delimiter(&node.delimiter); skip!(node.tokens); } @@ -2637,13 +2516,13 @@ where { match node { MacroDelimiter::Paren(_binding_0) => { - tokens_helper(v, &_binding_0.span); + skip!(_binding_0); } MacroDelimiter::Brace(_binding_0) => { - tokens_helper(v, &_binding_0.span); + skip!(_binding_0); } MacroDelimiter::Bracket(_binding_0) => { - tokens_helper(v, &_binding_0.span); + skip!(_binding_0); } } } @@ -2684,14 +2563,8 @@ where V: Visit<'ast> + ?Sized, { v.visit_path(&node.path); - tokens_helper(v, &node.paren_token.span); - for el in Punctuated::pairs(&node.nested) { - let (it, p) = el.into_tuple(); - v.visit_nested_meta(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } + v.visit_macro_delimiter(&node.delimiter); + skip!(node.tokens); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_meta_name_value<'ast, V>(v: &mut V, node: &'ast MetaNameValue) @@ -2699,38 +2572,8 @@ where V: Visit<'ast> + ?Sized, { v.visit_path(&node.path); - tokens_helper(v, &node.eq_token.spans); - v.visit_lit(&node.lit); -} -#[cfg(feature = "full")] -pub fn visit_method_turbofish<'ast, V>(v: &mut V, node: &'ast MethodTurbofish) -where - V: Visit<'ast> + ?Sized, -{ - tokens_helper(v, &node.colon2_token.spans); - tokens_helper(v, &node.lt_token.spans); - for el in Punctuated::pairs(&node.args) { - let (it, p) = el.into_tuple(); - v.visit_generic_method_argument(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } - tokens_helper(v, &node.gt_token.spans); -} -#[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_nested_meta<'ast, V>(v: &mut V, node: &'ast NestedMeta) -where - V: Visit<'ast> + ?Sized, -{ - match node { - NestedMeta::Meta(_binding_0) => { - v.visit_meta(_binding_0); - } - NestedMeta::Lit(_binding_0) => { - v.visit_lit(_binding_0); - } - } + skip!(node.eq_token); + v.visit_expr(&node.value); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_parenthesized_generic_arguments<'ast, V>( @@ -2740,13 +2583,10 @@ pub fn visit_parenthesized_generic_arguments<'ast, V>( where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.inputs) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } v.visit_return_type(&node.output); } @@ -2756,26 +2596,29 @@ where V: Visit<'ast> + ?Sized, { match node { - Pat::Box(_binding_0) => { - v.visit_pat_box(_binding_0); + Pat::Const(_binding_0) => { + v.visit_expr_const(_binding_0); } Pat::Ident(_binding_0) => { v.visit_pat_ident(_binding_0); } Pat::Lit(_binding_0) => { - v.visit_pat_lit(_binding_0); + v.visit_expr_lit(_binding_0); } Pat::Macro(_binding_0) => { - v.visit_pat_macro(_binding_0); + v.visit_expr_macro(_binding_0); } Pat::Or(_binding_0) => { v.visit_pat_or(_binding_0); } + Pat::Paren(_binding_0) => { + v.visit_pat_paren(_binding_0); + } Pat::Path(_binding_0) => { - v.visit_pat_path(_binding_0); + v.visit_expr_path(_binding_0); } Pat::Range(_binding_0) => { - v.visit_pat_range(_binding_0); + v.visit_expr_range(_binding_0); } Pat::Reference(_binding_0) => { v.visit_pat_reference(_binding_0); @@ -2804,22 +2647,9 @@ where Pat::Wild(_binding_0) => { v.visit_pat_wild(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] -pub fn visit_pat_box<'ast, V>(v: &mut V, node: &'ast PatBox) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - tokens_helper(v, &node.box_token.span); - v.visit_pat(&*node.pat); -} -#[cfg(feature = "full")] pub fn visit_pat_ident<'ast, V>(v: &mut V, node: &'ast PatIdent) where V: Visit<'ast> + ?Sized, @@ -2827,39 +2657,15 @@ where for it in &node.attrs { v.visit_attribute(it); } - if let Some(it) = &node.by_ref { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.by_ref); + skip!(node.mutability); v.visit_ident(&node.ident); if let Some(it) = &node.subpat { - tokens_helper(v, &(it).0.spans); + skip!((it).0); v.visit_pat(&*(it).1); } } #[cfg(feature = "full")] -pub fn visit_pat_lit<'ast, V>(v: &mut V, node: &'ast PatLit) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - v.visit_expr(&*node.expr); -} -#[cfg(feature = "full")] -pub fn visit_pat_macro<'ast, V>(v: &mut V, node: &'ast PatMacro) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - v.visit_macro(&node.mac); -} -#[cfg(feature = "full")] pub fn visit_pat_or<'ast, V>(v: &mut V, node: &'ast PatOr) where V: Visit<'ast> + ?Sized, @@ -2867,41 +2673,22 @@ where for it in &node.attrs { v.visit_attribute(it); } - if let Some(it) = &node.leading_vert { - tokens_helper(v, &it.spans); - } + skip!(node.leading_vert); for el in Punctuated::pairs(&node.cases) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_pat(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } -} -#[cfg(feature = "full")] -pub fn visit_pat_path<'ast, V>(v: &mut V, node: &'ast PatPath) -where - V: Visit<'ast> + ?Sized, -{ - for it in &node.attrs { - v.visit_attribute(it); - } - if let Some(it) = &node.qself { - v.visit_qself(it); } - v.visit_path(&node.path); } #[cfg(feature = "full")] -pub fn visit_pat_range<'ast, V>(v: &mut V, node: &'ast PatRange) +pub fn visit_pat_paren<'ast, V>(v: &mut V, node: &'ast PatParen) where V: Visit<'ast> + ?Sized, { for it in &node.attrs { v.visit_attribute(it); } - v.visit_expr(&*node.lo); - v.visit_range_limits(&node.limits); - v.visit_expr(&*node.hi); + skip!(node.paren_token); + v.visit_pat(&*node.pat); } #[cfg(feature = "full")] pub fn visit_pat_reference<'ast, V>(v: &mut V, node: &'ast PatReference) @@ -2911,10 +2698,8 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.and_token.spans); - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.and_token); + skip!(node.mutability); v.visit_pat(&*node.pat); } #[cfg(feature = "full")] @@ -2925,7 +2710,7 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.dot2_token.spans); + skip!(node.dot2_token); } #[cfg(feature = "full")] pub fn visit_pat_slice<'ast, V>(v: &mut V, node: &'ast PatSlice) @@ -2935,13 +2720,10 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); for el in Punctuated::pairs(&node.elems) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_pat(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -2952,17 +2734,17 @@ where for it in &node.attrs { v.visit_attribute(it); } + if let Some(it) = &node.qself { + v.visit_qself(it); + } v.visit_path(&node.path); - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for el in Punctuated::pairs(&node.fields) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_field_pat(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } - if let Some(it) = &node.dot2_token { - tokens_helper(v, &it.spans); + if let Some(it) = &node.rest { + v.visit_pat_rest(it); } } #[cfg(feature = "full")] @@ -2973,13 +2755,10 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.elems) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_pat(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -2990,8 +2769,15 @@ where for it in &node.attrs { v.visit_attribute(it); } + if let Some(it) = &node.qself { + v.visit_qself(it); + } v.visit_path(&node.path); - v.visit_pat_tuple(&node.pat); + skip!(node.paren_token); + for el in Punctuated::pairs(&node.elems) { + let it = el.value(); + v.visit_pat(it); + } } #[cfg(feature = "full")] pub fn visit_pat_type<'ast, V>(v: &mut V, node: &'ast PatType) @@ -3002,7 +2788,7 @@ where v.visit_attribute(it); } v.visit_pat(&*node.pat); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); v.visit_type(&*node.ty); } #[cfg(feature = "full")] @@ -3013,22 +2799,17 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.underscore_token.spans); + skip!(node.underscore_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_path<'ast, V>(v: &mut V, node: &'ast Path) where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.leading_colon { - tokens_helper(v, &it.spans); - } + skip!(node.leading_colon); for el in Punctuated::pairs(&node.segments) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_path_segment(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3055,27 +2836,15 @@ where v.visit_path_arguments(&node.arguments); } #[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_predicate_eq<'ast, V>(v: &mut V, node: &'ast PredicateEq) -where - V: Visit<'ast> + ?Sized, -{ - v.visit_type(&node.lhs_ty); - tokens_helper(v, &node.eq_token.spans); - v.visit_type(&node.rhs_ty); -} -#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_predicate_lifetime<'ast, V>(v: &mut V, node: &'ast PredicateLifetime) where V: Visit<'ast> + ?Sized, { v.visit_lifetime(&node.lifetime); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_lifetime(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3087,13 +2856,10 @@ where v.visit_bound_lifetimes(it); } v.visit_type(&node.bounded_ty); - tokens_helper(v, &node.colon_token.spans); + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3101,13 +2867,11 @@ pub fn visit_qself<'ast, V>(v: &mut V, node: &'ast QSelf) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.lt_token.spans); + skip!(node.lt_token); v.visit_type(&*node.ty); skip!(node.position); - if let Some(it) = &node.as_token { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.gt_token.spans); + skip!(node.as_token); + skip!(node.gt_token); } #[cfg(feature = "full")] pub fn visit_range_limits<'ast, V>(v: &mut V, node: &'ast RangeLimits) @@ -3116,10 +2880,10 @@ where { match node { RangeLimits::HalfOpen(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } RangeLimits::Closed(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } } } @@ -3132,15 +2896,15 @@ where v.visit_attribute(it); } if let Some(it) = &node.reference { - tokens_helper(v, &(it).0.spans); + skip!((it).0); if let Some(it) = &(it).1 { v.visit_lifetime(it); } } - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } - tokens_helper(v, &node.self_token.span); + skip!(node.mutability); + skip!(node.self_token); + skip!(node.colon_token); + v.visit_type(&*node.ty); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_return_type<'ast, V>(v: &mut V, node: &'ast ReturnType) @@ -3150,7 +2914,7 @@ where match node { ReturnType::Default => {} ReturnType::Type(_binding_0, _binding_1) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); v.visit_type(&**_binding_1); } } @@ -3160,28 +2924,19 @@ pub fn visit_signature<'ast, V>(v: &mut V, node: &'ast Signature) where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.constness { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.asyncness { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.unsafety { - tokens_helper(v, &it.span); - } + skip!(node.constness); + skip!(node.asyncness); + skip!(node.unsafety); if let Some(it) = &node.abi { v.visit_abi(it); } - tokens_helper(v, &node.fn_token.span); + skip!(node.fn_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.inputs) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_fn_arg(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } if let Some(it) = &node.variadic { v.visit_variadic(it); @@ -3193,6 +2948,18 @@ where V: Visit<'ast> + ?Sized, {} #[cfg(feature = "full")] +pub fn visit_static_mutability<'ast, V>(v: &mut V, node: &'ast StaticMutability) +where + V: Visit<'ast> + ?Sized, +{ + match node { + StaticMutability::Mut(_binding_0) => { + skip!(_binding_0); + } + StaticMutability::None => {} + } +} +#[cfg(feature = "full")] pub fn visit_stmt<'ast, V>(v: &mut V, node: &'ast Stmt) where V: Visit<'ast> + ?Sized, @@ -3204,23 +2971,32 @@ where Stmt::Item(_binding_0) => { v.visit_item(_binding_0); } - Stmt::Expr(_binding_0) => { + Stmt::Expr(_binding_0, _binding_1) => { v.visit_expr(_binding_0); + skip!(_binding_1); } - Stmt::Semi(_binding_0, _binding_1) => { - v.visit_expr(_binding_0); - tokens_helper(v, &_binding_1.spans); + Stmt::Macro(_binding_0) => { + v.visit_stmt_macro(_binding_0); } } } +#[cfg(feature = "full")] +pub fn visit_stmt_macro<'ast, V>(v: &mut V, node: &'ast StmtMacro) +where + V: Visit<'ast> + ?Sized, +{ + for it in &node.attrs { + v.visit_attribute(it); + } + v.visit_macro(&node.mac); + skip!(node.semi_token); +} #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_trait_bound<'ast, V>(v: &mut V, node: &'ast TraitBound) where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.paren_token { - tokens_helper(v, &it.span); - } + skip!(node.paren_token); v.visit_trait_bound_modifier(&node.modifier); if let Some(it) = &node.lifetimes { v.visit_bound_lifetimes(it); @@ -3235,7 +3011,7 @@ where match node { TraitBoundModifier::None => {} TraitBoundModifier::Maybe(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } } } @@ -3248,8 +3024,8 @@ where TraitItem::Const(_binding_0) => { v.visit_trait_item_const(_binding_0); } - TraitItem::Method(_binding_0) => { - v.visit_trait_item_method(_binding_0); + TraitItem::Fn(_binding_0) => { + v.visit_trait_item_fn(_binding_0); } TraitItem::Type(_binding_0) => { v.visit_trait_item_type(_binding_0); @@ -3260,8 +3036,6 @@ where TraitItem::Verbatim(_binding_0) => { skip!(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(feature = "full")] @@ -3272,44 +3046,41 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.const_token.span); + skip!(node.const_token); v.visit_ident(&node.ident); - tokens_helper(v, &node.colon_token.spans); + v.visit_generics(&node.generics); + skip!(node.colon_token); v.visit_type(&node.ty); if let Some(it) = &node.default { - tokens_helper(v, &(it).0.spans); + skip!((it).0); v.visit_expr(&(it).1); } - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(feature = "full")] -pub fn visit_trait_item_macro<'ast, V>(v: &mut V, node: &'ast TraitItemMacro) +pub fn visit_trait_item_fn<'ast, V>(v: &mut V, node: &'ast TraitItemFn) where V: Visit<'ast> + ?Sized, { for it in &node.attrs { v.visit_attribute(it); } - v.visit_macro(&node.mac); - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); + v.visit_signature(&node.sig); + if let Some(it) = &node.default { + v.visit_block(it); } + skip!(node.semi_token); } #[cfg(feature = "full")] -pub fn visit_trait_item_method<'ast, V>(v: &mut V, node: &'ast TraitItemMethod) +pub fn visit_trait_item_macro<'ast, V>(v: &mut V, node: &'ast TraitItemMacro) where V: Visit<'ast> + ?Sized, { for it in &node.attrs { v.visit_attribute(it); } - v.visit_signature(&node.sig); - if let Some(it) = &node.default { - v.visit_block(it); - } - if let Some(it) = &node.semi_token { - tokens_helper(v, &it.spans); - } + v.visit_macro(&node.mac); + skip!(node.semi_token); } #[cfg(feature = "full")] pub fn visit_trait_item_type<'ast, V>(v: &mut V, node: &'ast TraitItemType) @@ -3319,24 +3090,19 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.type_token.span); + skip!(node.type_token); v.visit_ident(&node.ident); v.visit_generics(&node.generics); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } if let Some(it) = &node.default { - tokens_helper(v, &(it).0.spans); + skip!((it).0); v.visit_type(&(it).1); } - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_type<'ast, V>(v: &mut V, node: &'ast Type) @@ -3389,8 +3155,6 @@ where Type::Verbatim(_binding_0) => { skip!(_binding_0); } - #[cfg(syn_no_non_exhaustive)] - _ => unreachable!(), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3398,9 +3162,9 @@ pub fn visit_type_array<'ast, V>(v: &mut V, node: &'ast TypeArray) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); v.visit_type(&*node.elem); - tokens_helper(v, &node.semi_token.spans); + skip!(node.semi_token); v.visit_expr(&node.len); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3411,23 +3175,18 @@ where if let Some(it) = &node.lifetimes { v.visit_bound_lifetimes(it); } - if let Some(it) = &node.unsafety { - tokens_helper(v, &it.span); - } + skip!(node.unsafety); if let Some(it) = &node.abi { v.visit_abi(it); } - tokens_helper(v, &node.fn_token.span); - tokens_helper(v, &node.paren_token.span); + skip!(node.fn_token); + skip!(node.paren_token); for el in Punctuated::pairs(&node.inputs) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_bare_fn_arg(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } if let Some(it) = &node.variadic { - v.visit_variadic(it); + v.visit_bare_variadic(it); } v.visit_return_type(&node.output); } @@ -3436,7 +3195,7 @@ pub fn visit_type_group<'ast, V>(v: &mut V, node: &'ast TypeGroup) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.group_token.span); + skip!(node.group_token); v.visit_type(&*node.elem); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3444,13 +3203,10 @@ pub fn visit_type_impl_trait<'ast, V>(v: &mut V, node: &'ast TypeImplTrait) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.impl_token.span); + skip!(node.impl_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3458,7 +3214,7 @@ pub fn visit_type_infer<'ast, V>(v: &mut V, node: &'ast TypeInfer) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.underscore_token.spans); + skip!(node.underscore_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_type_macro<'ast, V>(v: &mut V, node: &'ast TypeMacro) @@ -3472,7 +3228,7 @@ pub fn visit_type_never<'ast, V>(v: &mut V, node: &'ast TypeNever) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.bang_token.spans); + skip!(node.bang_token); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_type_param<'ast, V>(v: &mut V, node: &'ast TypeParam) @@ -3483,19 +3239,12 @@ where v.visit_attribute(it); } v.visit_ident(&node.ident); - if let Some(it) = &node.colon_token { - tokens_helper(v, &it.spans); - } + skip!(node.colon_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } - } - if let Some(it) = &node.eq_token { - tokens_helper(v, &it.spans); } + skip!(node.eq_token); if let Some(it) = &node.default { v.visit_type(it); } @@ -3512,6 +3261,9 @@ where TypeParamBound::Lifetime(_binding_0) => { v.visit_lifetime(_binding_0); } + TypeParamBound::Verbatim(_binding_0) => { + skip!(_binding_0); + } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3519,7 +3271,7 @@ pub fn visit_type_paren<'ast, V>(v: &mut V, node: &'ast TypeParen) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); v.visit_type(&*node.elem); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3537,13 +3289,9 @@ pub fn visit_type_ptr<'ast, V>(v: &mut V, node: &'ast TypePtr) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.star_token.spans); - if let Some(it) = &node.const_token { - tokens_helper(v, &it.span); - } - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.star_token); + skip!(node.const_token); + skip!(node.mutability); v.visit_type(&*node.elem); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3551,13 +3299,11 @@ pub fn visit_type_reference<'ast, V>(v: &mut V, node: &'ast TypeReference) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.and_token.spans); + skip!(node.and_token); if let Some(it) = &node.lifetime { v.visit_lifetime(it); } - if let Some(it) = &node.mutability { - tokens_helper(v, &it.span); - } + skip!(node.mutability); v.visit_type(&*node.elem); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3565,7 +3311,7 @@ pub fn visit_type_slice<'ast, V>(v: &mut V, node: &'ast TypeSlice) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.bracket_token.span); + skip!(node.bracket_token); v.visit_type(&*node.elem); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3573,15 +3319,10 @@ pub fn visit_type_trait_object<'ast, V>(v: &mut V, node: &'ast TypeTraitObject) where V: Visit<'ast> + ?Sized, { - if let Some(it) = &node.dyn_token { - tokens_helper(v, &it.span); - } + skip!(node.dyn_token); for el in Punctuated::pairs(&node.bounds) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type_param_bound(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3589,13 +3330,10 @@ pub fn visit_type_tuple<'ast, V>(v: &mut V, node: &'ast TypeTuple) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.paren_token.span); + skip!(node.paren_token); for el in Punctuated::pairs(&node.elems) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_type(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3605,13 +3343,13 @@ where { match node { UnOp::Deref(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } UnOp::Not(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } UnOp::Neg(_binding_0) => { - tokens_helper(v, &_binding_0.spans); + skip!(_binding_0); } } } @@ -3620,20 +3358,17 @@ pub fn visit_use_glob<'ast, V>(v: &mut V, node: &'ast UseGlob) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.star_token.spans); + skip!(node.star_token); } #[cfg(feature = "full")] pub fn visit_use_group<'ast, V>(v: &mut V, node: &'ast UseGroup) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.brace_token.span); + skip!(node.brace_token); for el in Punctuated::pairs(&node.items) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_use_tree(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(feature = "full")] @@ -3649,7 +3384,7 @@ where V: Visit<'ast> + ?Sized, { v.visit_ident(&node.ident); - tokens_helper(v, &node.colon2_token.spans); + skip!(node.colon2_token); v.visit_use_tree(&*node.tree); } #[cfg(feature = "full")] @@ -3658,7 +3393,7 @@ where V: Visit<'ast> + ?Sized, { v.visit_ident(&node.ident); - tokens_helper(v, &node.as_token.span); + skip!(node.as_token); v.visit_ident(&node.rename); } #[cfg(feature = "full")] @@ -3684,7 +3419,7 @@ where } } } -#[cfg(any(feature = "derive", feature = "full"))] +#[cfg(feature = "full")] pub fn visit_variadic<'ast, V>(v: &mut V, node: &'ast Variadic) where V: Visit<'ast> + ?Sized, @@ -3692,7 +3427,12 @@ where for it in &node.attrs { v.visit_attribute(it); } - tokens_helper(v, &node.dots.spans); + if let Some(it) = &node.pat { + v.visit_pat(&*(it).0); + skip!((it).1); + } + skip!(node.dots); + skip!(node.comma); } #[cfg(any(feature = "derive", feature = "full"))] pub fn visit_variant<'ast, V>(v: &mut V, node: &'ast Variant) @@ -3705,34 +3445,18 @@ where v.visit_ident(&node.ident); v.visit_fields(&node.fields); if let Some(it) = &node.discriminant { - tokens_helper(v, &(it).0.spans); + skip!((it).0); v.visit_expr(&(it).1); } } #[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_vis_crate<'ast, V>(v: &mut V, node: &'ast VisCrate) -where - V: Visit<'ast> + ?Sized, -{ - tokens_helper(v, &node.crate_token.span); -} -#[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_vis_public<'ast, V>(v: &mut V, node: &'ast VisPublic) -where - V: Visit<'ast> + ?Sized, -{ - tokens_helper(v, &node.pub_token.span); -} -#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_vis_restricted<'ast, V>(v: &mut V, node: &'ast VisRestricted) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.pub_token.span); - tokens_helper(v, &node.paren_token.span); - if let Some(it) = &node.in_token { - tokens_helper(v, &it.span); - } + skip!(node.pub_token); + skip!(node.paren_token); + skip!(node.in_token); v.visit_path(&*node.path); } #[cfg(any(feature = "derive", feature = "full"))] @@ -3742,10 +3466,7 @@ where { match node { Visibility::Public(_binding_0) => { - v.visit_vis_public(_binding_0); - } - Visibility::Crate(_binding_0) => { - v.visit_vis_crate(_binding_0); + skip!(_binding_0); } Visibility::Restricted(_binding_0) => { v.visit_vis_restricted(_binding_0); @@ -3758,13 +3479,10 @@ pub fn visit_where_clause<'ast, V>(v: &mut V, node: &'ast WhereClause) where V: Visit<'ast> + ?Sized, { - tokens_helper(v, &node.where_token.span); + skip!(node.where_token); for el in Punctuated::pairs(&node.predicates) { - let (it, p) = el.into_tuple(); + let it = el.value(); v.visit_where_predicate(it); - if let Some(p) = p { - tokens_helper(v, &p.spans); - } } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3773,14 +3491,11 @@ where V: Visit<'ast> + ?Sized, { match node { - WherePredicate::Type(_binding_0) => { - v.visit_predicate_type(_binding_0); - } WherePredicate::Lifetime(_binding_0) => { v.visit_predicate_lifetime(_binding_0); } - WherePredicate::Eq(_binding_0) => { - v.visit_predicate_eq(_binding_0); + WherePredicate::Type(_binding_0) => { + v.visit_predicate_type(_binding_0); } } } -- cgit v1.2.3