Restructure visit_ty in a more clear way

This commit is contained in:
Santiago Pastorino 2022-08-02 11:00:34 -03:00
parent 05b989e16e
commit 81c4d2371a
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF

View file

@ -38,12 +38,15 @@ impl<'this, 'ast: 'this> Visitor<'ast> for LifetimeCollectVisitor<'this, 'ast> {
}
fn visit_ty(&mut self, t: &'ast Ty) {
if let TyKind::BareFn(_) = t.kind {
self.current_binders.push(t.id);
}
visit::walk_ty(self, t);
if let TyKind::BareFn(_) = t.kind {
self.current_binders.pop();
match t.kind {
TyKind::BareFn(_) => {
self.current_binders.push(t.id);
visit::walk_ty(self, t);
self.current_binders.pop();
}
_ => {
visit::walk_ty(self, t);
}
}
}
}