From 6fcd38cc81bdcc9921da767872dfce65ee7d2d27 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 24 Dec 2018 21:00:14 +0100 Subject: Infer result of struct literals, and recurse into their child expressions --- crates/ra_syntax/src/ast/generated.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c73533861..334da67ef 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -2142,7 +2142,15 @@ impl> NamedFieldNode { } -impl<'a> NamedField<'a> {} +impl<'a> NamedField<'a> { + pub fn name_ref(self) -> Option> { + super::child_opt(self) + } + + pub fn expr(self) -> Option> { + super::child_opt(self) + } +} // NamedFieldDef #[derive(Debug, Clone, Copy,)] @@ -2218,7 +2226,11 @@ impl> NamedFieldListNode { } -impl<'a> NamedFieldList<'a> {} +impl<'a> NamedFieldList<'a> { + pub fn fields(self) -> impl Iterator> + 'a { + super::children(self) + } +} // NeverType #[derive(Debug, Clone, Copy,)] @@ -3467,7 +3479,15 @@ impl> StructLitNode { } -impl<'a> StructLit<'a> {} +impl<'a> StructLit<'a> { + pub fn path(self) -> Option> { + super::child_opt(self) + } + + pub fn named_field_list(self) -> Option> { + super::child_opt(self) + } +} // StructPat #[derive(Debug, Clone, Copy,)] -- cgit v1.2.3