diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 15:56:38 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 15:56:38 +0000 |
commit | 566c8e321e89e5ff8996daa615cc47aea0012881 (patch) | |
tree | 58c2f4741b9305e840d41eb35eb8f4e7d5761fe2 /crates/ra_syntax/src | |
parent | cefc5cbb4a95d2a473ea656efe603bef979b5c49 (diff) |
migrate enums to new id
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 7 |
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 | ||
432 | impl EnumVariant { | 432 | impl 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 | } |