change visit to fold for ty and reg
This commit is contained in:
@@ -12,13 +12,13 @@ use super::ty::{
|
||||
|
||||
pub trait Folder: Sized {
|
||||
type Break;
|
||||
fn visit_ty(&mut self, ty: &Ty) -> ControlFlow<Self::Break, Ty> {
|
||||
fn fold_ty(&mut self, ty: &Ty) -> ControlFlow<Self::Break, Ty> {
|
||||
ty.super_fold(self)
|
||||
}
|
||||
fn fold_const(&mut self, c: &Const) -> ControlFlow<Self::Break, Const> {
|
||||
c.super_fold(self)
|
||||
}
|
||||
fn visit_reg(&mut self, reg: &Region) -> ControlFlow<Self::Break, Region> {
|
||||
fn fold_reg(&mut self, reg: &Region) -> ControlFlow<Self::Break, Region> {
|
||||
reg.super_fold(self)
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ pub trait Foldable: Sized + Clone {
|
||||
|
||||
impl Foldable for Ty {
|
||||
fn fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
|
||||
folder.visit_ty(self)
|
||||
folder.fold_ty(self)
|
||||
}
|
||||
fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
|
||||
let mut kind = self.kind();
|
||||
@@ -114,7 +114,7 @@ impl Foldable for GenericArgs {
|
||||
|
||||
impl Foldable for Region {
|
||||
fn fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
|
||||
folder.visit_reg(self)
|
||||
folder.fold_reg(self)
|
||||
}
|
||||
fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
|
||||
let mut kind = self.kind.clone();
|
||||
@@ -257,7 +257,7 @@ pub enum Never {}
|
||||
impl Folder for GenericArgs {
|
||||
type Break = Never;
|
||||
|
||||
fn visit_ty(&mut self, ty: &Ty) -> ControlFlow<Self::Break, Ty> {
|
||||
fn fold_ty(&mut self, ty: &Ty) -> ControlFlow<Self::Break, Ty> {
|
||||
ControlFlow::Continue(match ty.kind() {
|
||||
TyKind::Param(p) => self[p],
|
||||
_ => *ty,
|
||||
|
||||
Reference in New Issue
Block a user