diff options
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index d18964d54..be1eaa523 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -8,7 +8,7 @@ use hir_expand::{ | |||
8 | use ra_arena::Arena; | 8 | use ra_arena::Arena; |
9 | use ra_syntax::{ | 9 | use ra_syntax::{ |
10 | ast::{ | 10 | ast::{ |
11 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner, RangeOp, | 11 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner, |
12 | TypeAscriptionOwner, | 12 | TypeAscriptionOwner, |
13 | }, | 13 | }, |
14 | AstNode, AstPtr, | 14 | AstNode, AstPtr, |
@@ -432,20 +432,11 @@ where | |||
432 | ast::Expr::RangeExpr(e) => { | 432 | ast::Expr::RangeExpr(e) => { |
433 | let lhs = e.start().map(|lhs| self.collect_expr(lhs)); | 433 | let lhs = e.start().map(|lhs| self.collect_expr(lhs)); |
434 | let rhs = e.end().map(|rhs| self.collect_expr(rhs)); | 434 | let rhs = e.end().map(|rhs| self.collect_expr(rhs)); |
435 | match (lhs, e.op_kind(), rhs) { | 435 | match e.op_kind() { |
436 | (None, _, None) => self.alloc_expr(Expr::RangeFull, syntax_ptr), | 436 | Some(range_type) => { |
437 | (Some(lhs), _, None) => self.alloc_expr(Expr::RangeFrom { lhs }, syntax_ptr), | 437 | self.alloc_expr(Expr::Range { lhs, rhs, range_type }, syntax_ptr) |
438 | (None, Some(RangeOp::Inclusive), Some(rhs)) => { | ||
439 | self.alloc_expr(Expr::RangeToInclusive { rhs }, syntax_ptr) | ||
440 | } | ||
441 | (Some(lhs), Some(RangeOp::Inclusive), Some(rhs)) => { | ||
442 | self.alloc_expr(Expr::RangeInclusive { lhs, rhs }, syntax_ptr) | ||
443 | } | ||
444 | // If RangeOp is missing, fallback to exclusive range. | ||
445 | (None, _, Some(rhs)) => self.alloc_expr(Expr::RangeTo { rhs }, syntax_ptr), | ||
446 | (Some(lhs), _, Some(rhs)) => { | ||
447 | self.alloc_expr(Expr::Range { lhs, rhs }, syntax_ptr) | ||
448 | } | 438 | } |
439 | None => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
449 | } | 440 | } |
450 | } | 441 | } |
451 | 442 | ||