diff options
author | Aleksey Kladov <[email protected]> | 2019-02-24 14:01:56 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-24 14:01:56 +0000 |
commit | 65a2be49539375502ca95c8da455f50f580df2e3 (patch) | |
tree | f5e07db7d5ddbc920a5d768f516bf3b6097ad817 /crates/ra_syntax/src | |
parent | 666303faf3c8b4215fde884451688084e298d6a8 (diff) |
complete struct literals
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) |