aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-24 15:56:38 +0000
committerAleksey Kladov <[email protected]>2019-01-24 15:56:38 +0000
commit566c8e321e89e5ff8996daa615cc47aea0012881 (patch)
tree58c2f4741b9305e840d41eb35eb8f4e7d5761fe2 /crates/ra_syntax/src
parentcefc5cbb4a95d2a473ea656efe603bef979b5c49 (diff)
migrate enums to new id
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index bcbd4c60c..fd65264b2 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -430,6 +430,13 @@ impl StructDef {
430} 430}
431 431
432impl EnumVariant { 432impl EnumVariant {
433 pub fn parent_enum(&self) -> &EnumDef {
434 self.syntax()
435 .parent()
436 .and_then(|it| it.parent())
437 .and_then(EnumDef::cast)
438 .expect("EnumVariants are always nested in Enums")
439 }
433 pub fn flavor(&self) -> StructFlavor { 440 pub fn flavor(&self) -> StructFlavor {
434 StructFlavor::from_node(self) 441 StructFlavor::from_node(self)
435 } 442 }