diff options
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index e656f9a41..5c779521b 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -8,7 +8,7 @@ use ra_arena::Arena; | |||
8 | use ra_syntax::{ | 8 | use ra_syntax::{ |
9 | ast::{ | 9 | ast::{ |
10 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, ModuleItemOwner, NameOwner, | 10 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, ModuleItemOwner, NameOwner, |
11 | TypeAscriptionOwner, | 11 | SlicePatComponents, TypeAscriptionOwner, |
12 | }, | 12 | }, |
13 | AstNode, AstPtr, | 13 | AstNode, AstPtr, |
14 | }; | 14 | }; |
@@ -591,7 +591,7 @@ where | |||
591 | let args = p.args().map(|p| self.collect_pat(p)).collect(); | 591 | let args = p.args().map(|p| self.collect_pat(p)).collect(); |
592 | Pat::Tuple(args) | 592 | Pat::Tuple(args) |
593 | } | 593 | } |
594 | ast::Pat::PlaceholderPat(_) => Pat::Wild, | 594 | ast::Pat::PlaceholderPat(_) | ast::Pat::DotDotPat(_) => Pat::Wild, |
595 | ast::Pat::RecordPat(p) => { | 595 | ast::Pat::RecordPat(p) => { |
596 | let path = p.path().and_then(|path| self.expander.parse_path(path)); | 596 | let path = p.path().and_then(|path| self.expander.parse_path(path)); |
597 | let record_field_pat_list = | 597 | let record_field_pat_list = |
@@ -616,12 +616,20 @@ where | |||
616 | 616 | ||
617 | Pat::Record { path, args: fields } | 617 | Pat::Record { path, args: fields } |
618 | } | 618 | } |
619 | ast::Pat::SlicePat(p) => { | ||
620 | let SlicePatComponents { prefix, slice, suffix } = p.components(); | ||
621 | |||
622 | Pat::Slice { | ||
623 | prefix: prefix.into_iter().map(|p| self.collect_pat(p)).collect(), | ||
624 | slice: slice.map(|p| self.collect_pat(p)), | ||
625 | suffix: suffix.into_iter().map(|p| self.collect_pat(p)).collect(), | ||
626 | } | ||
627 | } | ||
619 | 628 | ||
620 | // FIXME: implement | 629 | // FIXME: implement |
621 | ast::Pat::DotDotPat(_) => Pat::Missing, | ||
622 | ast::Pat::BoxPat(_) => Pat::Missing, | 630 | ast::Pat::BoxPat(_) => Pat::Missing, |
623 | ast::Pat::LiteralPat(_) => Pat::Missing, | 631 | ast::Pat::LiteralPat(_) => Pat::Missing, |
624 | ast::Pat::SlicePat(_) | ast::Pat::RangePat(_) => Pat::Missing, | 632 | ast::Pat::RangePat(_) => Pat::Missing, |
625 | }; | 633 | }; |
626 | let ptr = AstPtr::new(&pat); | 634 | let ptr = AstPtr::new(&pat); |
627 | self.alloc_pat(pattern, Either::Left(ptr)) | 635 | self.alloc_pat(pattern, Either::Left(ptr)) |