aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
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 }