diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 20e0a6856..56fb7c20c 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -724,6 +724,12 @@ impl LiteralExpr { | |||
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | impl NamedField { | ||
728 | pub fn parent_struct_lit(&self) -> &StructLit { | ||
729 | self.syntax().ancestors().find_map(StructLit::cast).unwrap() | ||
730 | } | ||
731 | } | ||
732 | |||
727 | impl BindPat { | 733 | impl BindPat { |
728 | pub fn is_mutable(&self) -> bool { | 734 | pub fn is_mutable(&self) -> bool { |
729 | self.syntax().children().any(|n| n.kind() == MUT_KW) | 735 | self.syntax().children().any(|n| n.kind() == MUT_KW) |