diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
commit | eefa10bc6bff3624ddd0bbb6bc89d8beb4bed186 (patch) | |
tree | 15c38c2993c52f4065d338090ca9185cc1fcd3da /crates/ra_hir_def/src/expr.rs | |
parent | a9d567584857b1be4ca8eaa5ef2c7d85f7b2845e (diff) | |
parent | 794f6da821c5d6e2490b996baffe162e4753262d (diff) |
Merge branch 'master' into assists_extract_enum
Diffstat (limited to 'crates/ra_hir_def/src/expr.rs')
-rw-r--r-- | crates/ra_hir_def/src/expr.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index a0cdad529..ca49b26d1 100644 --- a/crates/ra_hir_def/src/expr.rs +++ b/crates/ra_hir_def/src/expr.rs | |||
@@ -19,7 +19,7 @@ use ra_syntax::ast::RangeOp; | |||
19 | use crate::{ | 19 | use crate::{ |
20 | builtin_type::{BuiltinFloat, BuiltinInt}, | 20 | builtin_type::{BuiltinFloat, BuiltinInt}, |
21 | path::{GenericArgs, Path}, | 21 | path::{GenericArgs, Path}, |
22 | type_ref::{Mutability, TypeRef}, | 22 | type_ref::{Mutability, Rawness, TypeRef}, |
23 | }; | 23 | }; |
24 | 24 | ||
25 | pub type ExprId = Idx<Expr>; | 25 | pub type ExprId = Idx<Expr>; |
@@ -52,18 +52,22 @@ pub enum Expr { | |||
52 | Block { | 52 | Block { |
53 | statements: Vec<Statement>, | 53 | statements: Vec<Statement>, |
54 | tail: Option<ExprId>, | 54 | tail: Option<ExprId>, |
55 | label: Option<Name>, | ||
55 | }, | 56 | }, |
56 | Loop { | 57 | Loop { |
57 | body: ExprId, | 58 | body: ExprId, |
59 | label: Option<Name>, | ||
58 | }, | 60 | }, |
59 | While { | 61 | While { |
60 | condition: ExprId, | 62 | condition: ExprId, |
61 | body: ExprId, | 63 | body: ExprId, |
64 | label: Option<Name>, | ||
62 | }, | 65 | }, |
63 | For { | 66 | For { |
64 | iterable: ExprId, | 67 | iterable: ExprId, |
65 | pat: PatId, | 68 | pat: PatId, |
66 | body: ExprId, | 69 | body: ExprId, |
70 | label: Option<Name>, | ||
67 | }, | 71 | }, |
68 | Call { | 72 | Call { |
69 | callee: ExprId, | 73 | callee: ExprId, |
@@ -79,9 +83,12 @@ pub enum Expr { | |||
79 | expr: ExprId, | 83 | expr: ExprId, |
80 | arms: Vec<MatchArm>, | 84 | arms: Vec<MatchArm>, |
81 | }, | 85 | }, |
82 | Continue, | 86 | Continue { |
87 | label: Option<Name>, | ||
88 | }, | ||
83 | Break { | 89 | Break { |
84 | expr: Option<ExprId>, | 90 | expr: Option<ExprId>, |
91 | label: Option<Name>, | ||
85 | }, | 92 | }, |
86 | Return { | 93 | Return { |
87 | expr: Option<ExprId>, | 94 | expr: Option<ExprId>, |
@@ -110,6 +117,7 @@ pub enum Expr { | |||
110 | }, | 117 | }, |
111 | Ref { | 118 | Ref { |
112 | expr: ExprId, | 119 | expr: ExprId, |
120 | rawness: Rawness, | ||
113 | mutability: Mutability, | 121 | mutability: Mutability, |
114 | }, | 122 | }, |
115 | Box { | 123 | Box { |
@@ -224,7 +232,7 @@ impl Expr { | |||
224 | f(*else_branch); | 232 | f(*else_branch); |
225 | } | 233 | } |
226 | } | 234 | } |
227 | Expr::Block { statements, tail } => { | 235 | Expr::Block { statements, tail, .. } => { |
228 | for stmt in statements { | 236 | for stmt in statements { |
229 | match stmt { | 237 | match stmt { |
230 | Statement::Let { initializer, .. } => { | 238 | Statement::Let { initializer, .. } => { |
@@ -240,8 +248,8 @@ impl Expr { | |||
240 | } | 248 | } |
241 | } | 249 | } |
242 | Expr::TryBlock { body } => f(*body), | 250 | Expr::TryBlock { body } => f(*body), |
243 | Expr::Loop { body } => f(*body), | 251 | Expr::Loop { body, .. } => f(*body), |
244 | Expr::While { condition, body } => { | 252 | Expr::While { condition, body, .. } => { |
245 | f(*condition); | 253 | f(*condition); |
246 | f(*body); | 254 | f(*body); |
247 | } | 255 | } |
@@ -267,8 +275,8 @@ impl Expr { | |||
267 | f(arm.expr); | 275 | f(arm.expr); |
268 | } | 276 | } |
269 | } | 277 | } |
270 | Expr::Continue => {} | 278 | Expr::Continue { .. } => {} |
271 | Expr::Break { expr } | Expr::Return { expr } => { | 279 | Expr::Break { expr, .. } | Expr::Return { expr } => { |
272 | if let Some(expr) = expr { | 280 | if let Some(expr) = expr { |
273 | f(*expr); | 281 | f(*expr); |
274 | } | 282 | } |