diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 14:39:38 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 14:39:38 +0000 |
commit | 67528c4b3943a2027839a25770d079132a9ea130 (patch) | |
tree | 571b1729dd66b3597736069834529ba88460f2fe /crates/ra_syntax/src/ast.rs | |
parent | c52c8c2c5bd8b054eee5946ce5e5bd7ecfe9998a (diff) | |
parent | 6285fcc39b70bc92de5188a5eb64ee8d73fa8970 (diff) |
Merge #891
891: Field completion r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-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) |