Make ForeignItem
an alias of Item
.
This commit is contained in:
parent
41601a8c95
commit
c8850c7144
4 changed files with 10 additions and 14 deletions
|
@ -1181,6 +1181,7 @@ impl<'a> Parser<'a> {
|
||||||
attrs,
|
attrs,
|
||||||
vis: visibility,
|
vis: visibility,
|
||||||
kind: ForeignItemKind::Macro(mac),
|
kind: ForeignItemKind::Macro(mac),
|
||||||
|
tokens: None,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1211,6 +1212,7 @@ impl<'a> Parser<'a> {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
span: lo.to(hi),
|
span: lo.to(hi),
|
||||||
vis,
|
vis,
|
||||||
|
tokens: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1228,7 +1230,8 @@ impl<'a> Parser<'a> {
|
||||||
kind: ForeignItemKind::Ty,
|
kind: ForeignItemKind::Ty,
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
span: lo.to(hi),
|
span: lo.to(hi),
|
||||||
vis
|
vis,
|
||||||
|
tokens: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1826,6 +1829,7 @@ impl<'a> Parser<'a> {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
span,
|
span,
|
||||||
vis,
|
vis,
|
||||||
|
tokens: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2488,14 +2488,14 @@ impl VariantData {
|
||||||
///
|
///
|
||||||
/// The name might be a dummy name in case of anonymous items.
|
/// The name might be a dummy name in case of anonymous items.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Item {
|
pub struct Item<K = ItemKind> {
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub vis: Visibility,
|
pub vis: Visibility,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
|
||||||
pub kind: ItemKind,
|
pub kind: K,
|
||||||
|
|
||||||
/// Original tokens this item was parsed from. This isn't necessarily
|
/// Original tokens this item was parsed from. This isn't necessarily
|
||||||
/// available for all items, although over time more and more items should
|
/// available for all items, although over time more and more items should
|
||||||
|
@ -2650,16 +2650,7 @@ impl ItemKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
pub type ForeignItem = Item<ForeignItemKind>;
|
||||||
pub struct ForeignItem {
|
|
||||||
pub attrs: Vec<Attribute>,
|
|
||||||
pub id: NodeId,
|
|
||||||
pub span: Span,
|
|
||||||
pub vis: Visibility,
|
|
||||||
pub ident: Ident,
|
|
||||||
|
|
||||||
pub kind: ForeignItemKind,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An item within an `extern` block.
|
/// An item within an `extern` block.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
|
|
|
@ -1053,7 +1053,7 @@ pub fn noop_flat_map_item<T: MutVisitor>(mut item: P<Item>, visitor: &mut T)
|
||||||
pub fn noop_flat_map_foreign_item<T: MutVisitor>(mut item: ForeignItem, visitor: &mut T)
|
pub fn noop_flat_map_foreign_item<T: MutVisitor>(mut item: ForeignItem, visitor: &mut T)
|
||||||
-> SmallVec<[ForeignItem; 1]>
|
-> SmallVec<[ForeignItem; 1]>
|
||||||
{
|
{
|
||||||
let ForeignItem { ident, attrs, kind, id, span, vis } = &mut item;
|
let ForeignItem { ident, attrs, id, kind, vis, span, tokens: _ } = &mut item;
|
||||||
visitor.visit_ident(ident);
|
visitor.visit_ident(ident);
|
||||||
visit_attrs(attrs, visitor);
|
visit_attrs(attrs, visitor);
|
||||||
match kind {
|
match kind {
|
||||||
|
|
|
@ -65,6 +65,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId, vis: Option<ast::Visi
|
||||||
AstFragment::ForeignItems(smallvec![ast::ForeignItem {
|
AstFragment::ForeignItems(smallvec![ast::ForeignItem {
|
||||||
id, span, ident, vis, attrs,
|
id, span, ident, vis, attrs,
|
||||||
kind: ast::ForeignItemKind::Macro(mac_placeholder()),
|
kind: ast::ForeignItemKind::Macro(mac_placeholder()),
|
||||||
|
tokens: None,
|
||||||
}]),
|
}]),
|
||||||
AstFragmentKind::Pat => AstFragment::Pat(P(ast::Pat {
|
AstFragmentKind::Pat => AstFragment::Pat(P(ast::Pat {
|
||||||
id, span, kind: ast::PatKind::Mac(mac_placeholder()),
|
id, span, kind: ast::PatKind::Mac(mac_placeholder()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue