Returns true if `#[derive(... FeatureMetadata ...)]` is present on the type, indicating `visit_feature`/`exit_feature` calls should be emitted in `accept()`.
(attrs: &[Attribute])
| 71 | /// Returns true if `#[derive(... FeatureMetadata ...)]` is present on the type, |
| 72 | /// indicating `visit_feature`/`exit_feature` calls should be emitted in `accept()`. |
| 73 | fn has_feature_metadata(attrs: &[Attribute]) -> bool { |
| 74 | attrs.iter().any(|attr| { |
| 75 | if !attr.path().is_ident("derive") { |
| 76 | return false; |
| 77 | } |
| 78 | let Meta::List(list) = &attr.meta else { return false }; |
| 79 | // Parse as comma-separated paths and check for FeatureMetadata |
| 80 | list.parse_args_with(syn::punctuated::Punctuated::<syn::Path, syn::Token![,]>::parse_terminated) |
| 81 | .map(|paths| paths.iter().any(|p| p.is_ident("FeatureMetadata"))) |
| 82 | .unwrap_or(false) |
| 83 | }) |
| 84 | } |
| 85 | |
| 86 | fn make_body(s: &Structure, accept: &syn::Ident, wc: &mut WhereCollector, use_try_visit: bool) -> TokenStream { |
| 87 | match &s.ast().data { |