diff options
Diffstat (limited to 'crates/ra_hir_def/src/expr.rs')
-rw-r--r-- | crates/ra_hir_def/src/expr.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index 04c1d8f69..a75ef9970 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,6 +131,11 @@ pub enum Expr { | |||
130 | rhs: ExprId, | 131 | rhs: ExprId, |
131 | op: Option<BinaryOp>, | 132 | op: Option<BinaryOp>, |
132 | }, | 133 | }, |
134 | Range { | ||
135 | lhs: Option<ExprId>, | ||
136 | rhs: Option<ExprId>, | ||
137 | range_type: RangeOp, | ||
138 | }, | ||
133 | Index { | 139 | Index { |
134 | base: ExprId, | 140 | base: ExprId, |
135 | index: ExprId, | 141 | index: ExprId, |
@@ -137,6 +143,7 @@ pub enum Expr { | |||
137 | Lambda { | 143 | Lambda { |
138 | args: Vec<PatId>, | 144 | args: Vec<PatId>, |
139 | arg_types: Vec<Option<TypeRef>>, | 145 | arg_types: Vec<Option<TypeRef>>, |
146 | ret_type: Option<TypeRef>, | ||
140 | body: ExprId, | 147 | body: ExprId, |
141 | }, | 148 | }, |
142 | Tuple { | 149 | Tuple { |
@@ -288,6 +295,14 @@ impl Expr { | |||
288 | f(*lhs); | 295 | f(*lhs); |
289 | f(*rhs); | 296 | f(*rhs); |
290 | } | 297 | } |
298 | Expr::Range { lhs, rhs, .. } => { | ||
299 | if let Some(lhs) = rhs { | ||
300 | f(*lhs); | ||
301 | } | ||
302 | if let Some(rhs) = lhs { | ||
303 | f(*rhs); | ||
304 | } | ||
305 | } | ||
291 | Expr::Index { base, index } => { | 306 | Expr::Index { base, index } => { |
292 | f(*base); | 307 | f(*base); |
293 | f(*index); | 308 | f(*index); |