Add detection of dead struct fields

This commit is contained in:
Jakub Wieczorek 2014-06-06 00:00:29 +02:00
parent 7580ef902e
commit 0271224bda
3 changed files with 155 additions and 2 deletions

View file

@ -1046,6 +1046,15 @@ pub struct StructField_ {
pub attrs: Vec<Attribute>,
}
impl StructField_ {
pub fn ident(&self) -> Option<Ident> {
match self.kind {
NamedField(ref ident, _) => Some(ident.clone()),
UnnamedField(_) => None
}
}
}
pub type StructField = Spanned<StructField_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]