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