diff options
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 30 | ||||
-rw-r--r-- | crates/ra_hir_def/src/expr.rs | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index dc52c6bd9..f159f80af 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -218,7 +218,10 @@ impl ExprCollector<'_> { | |||
218 | self.alloc_expr( | 218 | self.alloc_expr( |
219 | Expr::Loop { | 219 | Expr::Loop { |
220 | body, | 220 | body, |
221 | label: e.label().and_then(|l| l.lifetime_token()).map(|l| Name::new_lifetime(&l)), | 221 | label: e |
222 | .label() | ||
223 | .and_then(|l| l.lifetime_token()) | ||
224 | .map(|l| Name::new_lifetime(&l)), | ||
222 | }, | 225 | }, |
223 | syntax_ptr, | 226 | syntax_ptr, |
224 | ) | 227 | ) |
@@ -247,7 +250,10 @@ impl ExprCollector<'_> { | |||
247 | return self.alloc_expr( | 250 | return self.alloc_expr( |
248 | Expr::Loop { | 251 | Expr::Loop { |
249 | body: match_expr, | 252 | body: match_expr, |
250 | label: e.label().and_then(|l| l.lifetime_token()).map(|l| Name::new_lifetime(&l)), | 253 | label: e |
254 | .label() | ||
255 | .and_then(|l| l.lifetime_token()) | ||
256 | .map(|l| Name::new_lifetime(&l)), | ||
251 | }, | 257 | }, |
252 | syntax_ptr, | 258 | syntax_ptr, |
253 | ); | 259 | ); |
@@ -259,7 +265,10 @@ impl ExprCollector<'_> { | |||
259 | Expr::While { | 265 | Expr::While { |
260 | condition, | 266 | condition, |
261 | body, | 267 | body, |
262 | label: e.label().and_then(|l| l.lifetime_token()).map(|l| Name::new_lifetime(&l)), | 268 | label: e |
269 | .label() | ||
270 | .and_then(|l| l.lifetime_token()) | ||
271 | .map(|l| Name::new_lifetime(&l)), | ||
263 | }, | 272 | }, |
264 | syntax_ptr, | 273 | syntax_ptr, |
265 | ) | 274 | ) |
@@ -273,7 +282,10 @@ impl ExprCollector<'_> { | |||
273 | iterable, | 282 | iterable, |
274 | pat, | 283 | pat, |
275 | body, | 284 | body, |
276 | label: e.label().and_then(|l| l.lifetime_token()).map(|l| Name::new_lifetime(&l)), | 285 | label: e |
286 | .label() | ||
287 | .and_then(|l| l.lifetime_token()) | ||
288 | .map(|l| Name::new_lifetime(&l)), | ||
277 | }, | 289 | }, |
278 | syntax_ptr, | 290 | syntax_ptr, |
279 | ) | 291 | ) |
@@ -329,12 +341,10 @@ impl ExprCollector<'_> { | |||
329 | .unwrap_or(Expr::Missing); | 341 | .unwrap_or(Expr::Missing); |
330 | self.alloc_expr(path, syntax_ptr) | 342 | self.alloc_expr(path, syntax_ptr) |
331 | } | 343 | } |
332 | ast::Expr::ContinueExpr(e) => { | 344 | ast::Expr::ContinueExpr(e) => self.alloc_expr( |
333 | self.alloc_expr( | 345 | Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, |
334 | Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, | 346 | syntax_ptr, |
335 | syntax_ptr, | 347 | ), |
336 | ) | ||
337 | } | ||
338 | ast::Expr::BreakExpr(e) => { | 348 | ast::Expr::BreakExpr(e) => { |
339 | let expr = e.expr().map(|e| self.collect_expr(e)); | 349 | let expr = e.expr().map(|e| self.collect_expr(e)); |
340 | self.alloc_expr( | 350 | self.alloc_expr( |
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index 8683f6c7f..ca49b26d1 100644 --- a/crates/ra_hir_def/src/expr.rs +++ b/crates/ra_hir_def/src/expr.rs | |||
@@ -275,7 +275,7 @@ impl Expr { | |||
275 | f(arm.expr); | 275 | f(arm.expr); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | Expr::Continue { .. } => {}, | 278 | Expr::Continue { .. } => {} |
279 | Expr::Break { expr, .. } | Expr::Return { expr } => { | 279 | Expr::Break { expr, .. } | Expr::Return { expr } => { |
280 | if let Some(expr) = expr { | 280 | if let Some(expr) = expr { |
281 | f(*expr); | 281 | f(*expr); |