diff options
Diffstat (limited to 'crates/ra_hir_def/src/expr.rs')
-rw-r--r-- | crates/ra_hir_def/src/expr.rs | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index 115090218..6fad80a8d 100644 --- a/crates/ra_hir_def/src/expr.rs +++ b/crates/ra_hir_def/src/expr.rs | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | use hir_expand::name::Name; | 15 | use hir_expand::name::Name; |
16 | use ra_arena::{impl_arena_id, RawId}; | 16 | use ra_arena::{impl_arena_id, RawId}; |
17 | use ra_syntax::ast::RangeOp; | ||
17 | 18 | ||
18 | use crate::{ | 19 | use crate::{ |
19 | builtin_type::{BuiltinFloat, BuiltinInt}, | 20 | builtin_type::{BuiltinFloat, BuiltinInt}, |
@@ -130,23 +131,10 @@ pub enum Expr { | |||
130 | rhs: ExprId, | 131 | rhs: ExprId, |
131 | op: Option<BinaryOp>, | 132 | op: Option<BinaryOp>, |
132 | }, | 133 | }, |
133 | RangeFull, | ||
134 | RangeFrom { | ||
135 | lhs: ExprId, | ||
136 | }, | ||
137 | RangeTo { | ||
138 | rhs: ExprId, | ||
139 | }, | ||
140 | Range { | 134 | Range { |
141 | lhs: ExprId, | 135 | lhs: Option<ExprId>, |
142 | rhs: ExprId, | 136 | rhs: Option<ExprId>, |
143 | }, | 137 | range_type: RangeOp, |
144 | RangeToInclusive { | ||
145 | rhs: ExprId, | ||
146 | }, | ||
147 | RangeInclusive { | ||
148 | lhs: ExprId, | ||
149 | rhs: ExprId, | ||
150 | }, | 138 | }, |
151 | Index { | 139 | Index { |
152 | base: ExprId, | 140 | base: ExprId, |
@@ -302,21 +290,23 @@ impl Expr { | |||
302 | Expr::Lambda { body, .. } => { | 290 | Expr::Lambda { body, .. } => { |
303 | f(*body); | 291 | f(*body); |
304 | } | 292 | } |
305 | Expr::BinaryOp { lhs, rhs, .. } | 293 | Expr::BinaryOp { lhs, rhs, .. } => { |
306 | | Expr::Range { lhs, rhs } | ||
307 | | Expr::RangeInclusive { lhs, rhs } => { | ||
308 | f(*lhs); | 294 | f(*lhs); |
309 | f(*rhs); | 295 | f(*rhs); |
310 | } | 296 | } |
297 | Expr::Range { lhs, rhs, .. } => { | ||
298 | if let Some(lhs) = rhs { | ||
299 | f(*lhs); | ||
300 | } | ||
301 | if let Some(rhs) = lhs { | ||
302 | f(*rhs); | ||
303 | } | ||
304 | } | ||
311 | Expr::Index { base, index } => { | 305 | Expr::Index { base, index } => { |
312 | f(*base); | 306 | f(*base); |
313 | f(*index); | 307 | f(*index); |
314 | } | 308 | } |
315 | Expr::RangeFull => {} | 309 | Expr::Field { expr, .. } |
316 | Expr::RangeFrom { lhs: expr } | ||
317 | | Expr::RangeTo { rhs: expr } | ||
318 | | Expr::RangeToInclusive { rhs: expr } | ||
319 | | Expr::Field { expr, .. } | ||
320 | | Expr::Await { expr } | 310 | | Expr::Await { expr } |
321 | | Expr::Try { expr } | 311 | | Expr::Try { expr } |
322 | | Expr::Cast { expr, .. } | 312 | | Expr::Cast { expr, .. } |