1
Fork 0

Rollup merge of #132787 - maxcabrajac:fnctxt, r=petrochenkov

Unify FnKind between AST visitors and make WalkItemKind more straight forward

Unifying `FnKind` requires a bunch of changes to `WalkItemKind::walk` signature so I'll change them in one go

related to #128974

r? `@petrochenkov`
This commit is contained in:
Matthias Krüger 2024-11-16 21:05:46 +01:00 committed by GitHub
commit 6b47c6d786
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 157 additions and 88 deletions

View file

@ -1303,7 +1303,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitItemTag>
fragment.make_trait_items()
}
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
walk_flat_map_item(visitor, self.wrapped)
walk_flat_map_assoc_item(visitor, self.wrapped, AssocCtxt::Trait)
}
fn is_mac_call(&self) -> bool {
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
@ -1344,7 +1344,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, ImplItemTag>
fragment.make_impl_items()
}
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
walk_flat_map_item(visitor, self.wrapped)
walk_flat_map_assoc_item(visitor, self.wrapped, AssocCtxt::Impl)
}
fn is_mac_call(&self) -> bool {
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))

View file

@ -286,7 +286,7 @@ impl MutVisitor for PlaceholderExpander {
AssocCtxt::Impl => it.make_impl_items(),
}
}
_ => walk_flat_map_item(self, item),
_ => walk_flat_map_assoc_item(self, item, ctxt),
}
}