migrate enums to new id

This commit is contained in:
Aleksey Kladov 2019-01-24 18:56:38 +03:00
parent cefc5cbb4a
commit 566c8e321e
9 changed files with 190 additions and 142 deletions

View file

@ -430,6 +430,13 @@ impl StructDef {
}
impl EnumVariant {
pub fn parent_enum(&self) -> &EnumDef {
self.syntax()
.parent()
.and_then(|it| it.parent())
.and_then(EnumDef::cast)
.expect("EnumVariants are always nested in Enums")
}
pub fn flavor(&self) -> StructFlavor {
StructFlavor::from_node(self)
}