diff options
author | Florian Diebold <[email protected]> | 2018-12-24 20:00:14 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-25 14:16:42 +0000 |
commit | 6fcd38cc81bdcc9921da767872dfce65ee7d2d27 (patch) | |
tree | 5d5ae0f57cc25d0bf8b0613a5e05de1f773b42ef /crates/ra_syntax/src/ast | |
parent | 4ff161852016c6c15954d6f30bd637834a2b2b68 (diff) |
Infer result of struct literals, and recurse into their child expressions
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 26 |
1 files changed, 23 insertions, 3 deletions
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<R: TreeRoot<RaTypes>> NamedFieldNode<R> { | |||
2142 | } | 2142 | } |
2143 | 2143 | ||
2144 | 2144 | ||
2145 | impl<'a> NamedField<'a> {} | 2145 | impl<'a> NamedField<'a> { |
2146 | pub fn name_ref(self) -> Option<NameRef<'a>> { | ||
2147 | super::child_opt(self) | ||
2148 | } | ||
2149 | |||
2150 | pub fn expr(self) -> Option<Expr<'a>> { | ||
2151 | super::child_opt(self) | ||
2152 | } | ||
2153 | } | ||
2146 | 2154 | ||
2147 | // NamedFieldDef | 2155 | // NamedFieldDef |
2148 | #[derive(Debug, Clone, Copy,)] | 2156 | #[derive(Debug, Clone, Copy,)] |
@@ -2218,7 +2226,11 @@ impl<R: TreeRoot<RaTypes>> NamedFieldListNode<R> { | |||
2218 | } | 2226 | } |
2219 | 2227 | ||
2220 | 2228 | ||
2221 | impl<'a> NamedFieldList<'a> {} | 2229 | impl<'a> NamedFieldList<'a> { |
2230 | pub fn fields(self) -> impl Iterator<Item = NamedField<'a>> + 'a { | ||
2231 | super::children(self) | ||
2232 | } | ||
2233 | } | ||
2222 | 2234 | ||
2223 | // NeverType | 2235 | // NeverType |
2224 | #[derive(Debug, Clone, Copy,)] | 2236 | #[derive(Debug, Clone, Copy,)] |
@@ -3467,7 +3479,15 @@ impl<R: TreeRoot<RaTypes>> StructLitNode<R> { | |||
3467 | } | 3479 | } |
3468 | 3480 | ||
3469 | 3481 | ||
3470 | impl<'a> StructLit<'a> {} | 3482 | impl<'a> StructLit<'a> { |
3483 | pub fn path(self) -> Option<Path<'a>> { | ||
3484 | super::child_opt(self) | ||
3485 | } | ||
3486 | |||
3487 | pub fn named_field_list(self) -> Option<NamedFieldList<'a>> { | ||
3488 | super::child_opt(self) | ||
3489 | } | ||
3490 | } | ||
3471 | 3491 | ||
3472 | // StructPat | 3492 | // StructPat |
3473 | #[derive(Debug, Clone, Copy,)] | 3493 | #[derive(Debug, Clone, Copy,)] |