rustc: rename multiple imports in a list

This commit is contained in:
Sean McArthur 2015-07-31 22:20:25 -07:00
parent d03456183e
commit cfcd449c4c
16 changed files with 170 additions and 34 deletions

View file

@ -1656,14 +1656,29 @@ pub type Variant = Spanned<Variant_>;
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum PathListItem_ {
PathListIdent { name: Ident, id: NodeId },
PathListMod { id: NodeId }
PathListIdent {
name: Ident,
/// renamed in list, eg `use foo::{bar as baz};`
rename: Option<Ident>,
id: NodeId
},
PathListMod {
/// renamed in list, eg `use foo::{self as baz};`
rename: Option<Ident>,
id: NodeId
}
}
impl PathListItem_ {
pub fn id(&self) -> NodeId {
match *self {
PathListIdent { id, .. } | PathListMod { id } => id
PathListIdent { id, .. } | PathListMod { id, .. } => id
}
}
pub fn rename(&self) -> Option<Ident> {
match *self {
PathListIdent { rename, .. } | PathListMod { rename, .. } => rename
}
}
}