From 65a2be49539375502ca95c8da455f50f580df2e3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Feb 2019 17:01:56 +0300 Subject: complete struct literals --- crates/ra_syntax/src/ast.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/ra_syntax/src') 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 { } } +impl NamedField { + pub fn parent_struct_lit(&self) -> &StructLit { + self.syntax().ancestors().find_map(StructLit::cast).unwrap() + } +} + impl BindPat { pub fn is_mutable(&self) -> bool { self.syntax().children().any(|n| n.kind() == MUT_KW) -- cgit v1.2.3