Add Crate and Restricted variants to ast::Visibility
This commit is contained in:
@@ -288,6 +288,10 @@ pub trait Folder : Sized {
|
||||
noop_fold_where_predicate(where_predicate, self)
|
||||
}
|
||||
|
||||
fn fold_vis(&mut self, vis: Visibility) -> Visibility {
|
||||
noop_fold_vis(vis, self)
|
||||
}
|
||||
|
||||
fn new_id(&mut self, i: NodeId) -> NodeId {
|
||||
i
|
||||
}
|
||||
@@ -992,7 +996,7 @@ pub fn noop_fold_impl_item<T: Folder>(i: ImplItem, folder: &mut T)
|
||||
id: folder.new_id(i.id),
|
||||
ident: folder.fold_ident(i.ident),
|
||||
attrs: fold_attrs(i.attrs, folder),
|
||||
vis: i.vis,
|
||||
vis: folder.fold_vis(i.vis),
|
||||
defaultness: i.defaultness,
|
||||
node: match i.node {
|
||||
ast::ImplItemKind::Const(ty, expr) => {
|
||||
@@ -1082,7 +1086,7 @@ pub fn noop_fold_item_simple<T: Folder>(Item {id, ident, attrs, node, vis, span}
|
||||
ident: folder.fold_ident(ident),
|
||||
attrs: fold_attrs(attrs, folder),
|
||||
node: node,
|
||||
vis: vis,
|
||||
vis: folder.fold_vis(vis),
|
||||
span: folder.new_span(span)
|
||||
}
|
||||
}
|
||||
@@ -1100,7 +1104,7 @@ pub fn noop_fold_foreign_item<T: Folder>(ni: ForeignItem, folder: &mut T) -> For
|
||||
ForeignItemKind::Static(folder.fold_ty(t), m)
|
||||
}
|
||||
},
|
||||
vis: ni.vis,
|
||||
vis: folder.fold_vis(ni.vis),
|
||||
span: folder.new_span(ni.span)
|
||||
}
|
||||
}
|
||||
@@ -1391,6 +1395,16 @@ pub fn noop_fold_stmt<T: Folder>(Spanned {node, span}: Stmt, folder: &mut T)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_vis<T: Folder>(vis: Visibility, folder: &mut T) -> Visibility {
|
||||
match vis {
|
||||
Visibility::Restricted { path, id } => Visibility::Restricted {
|
||||
path: path.map(|path| folder.fold_path(path)),
|
||||
id: folder.new_id(id)
|
||||
},
|
||||
_ => vis,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::io;
|
||||
|
||||
Reference in New Issue
Block a user