diff options
author | Paul Daniel Faria <[email protected]> | 2020-06-02 23:04:23 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-06-27 15:13:14 +0100 |
commit | f78df42f813504a376dca555b04ac427582f542c (patch) | |
tree | 6fcf36c429b6e286cda892f0df16812633af70a9 /crates | |
parent | 2608a6fd3a024206d4776cc391e46ef28c018434 (diff) |
Fix issues caused during rebase
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 108 |
1 files changed, 63 insertions, 45 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 114b38710..4240c6ad8 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -318,16 +318,20 @@ impl ExprCollector<'_> { | |||
318 | ast::Expr::BlockExpr(e) => self.collect_block(e), | 318 | ast::Expr::BlockExpr(e) => self.collect_block(e), |
319 | ast::Expr::LoopExpr(e) => { | 319 | ast::Expr::LoopExpr(e) => { |
320 | let body = self.collect_block_opt(e.loop_body()); | 320 | let body = self.collect_block_opt(e.loop_body()); |
321 | track_parent!(self, self.alloc_expr(Expr::Loop { body }, syntax_ptr), vec![body]) | 321 | track_parent!( |
322 | Expr::Loop { | 322 | self, |
323 | body, | 323 | self.alloc_expr( |
324 | label: e | 324 | Expr::Loop { |
325 | .label() | 325 | body, |
326 | .and_then(|l| l.lifetime_token()) | 326 | label: e |
327 | .map(|l| Name::new_lifetime(&l)), | 327 | .label() |
328 | }, | 328 | .and_then(|l| l.lifetime_token()) |
329 | syntax_ptr, | 329 | .map(|l| Name::new_lifetime(&l)), |
330 | ), body) | 330 | }, |
331 | syntax_ptr, | ||
332 | ), | ||
333 | body | ||
334 | ) | ||
331 | } | 335 | } |
332 | ast::Expr::WhileExpr(e) => { | 336 | ast::Expr::WhileExpr(e) => { |
333 | let body = self.collect_block_opt(e.loop_body()); | 337 | let body = self.collect_block_opt(e.loop_body()); |
@@ -350,48 +354,62 @@ impl ExprCollector<'_> { | |||
350 | ]; | 354 | ]; |
351 | let match_expr = | 355 | let match_expr = |
352 | self.alloc_expr_desugared(Expr::Match { expr: match_expr, arms }); | 356 | self.alloc_expr_desugared(Expr::Match { expr: match_expr, arms }); |
353 | return track_parent!(self, self.alloc_expr( | 357 | return track_parent!( |
354 | Expr::Loop { | 358 | self, |
355 | body: match_expr, | 359 | self.alloc_expr( |
356 | label: e | 360 | Expr::Loop { |
357 | .label() | 361 | body: match_expr, |
358 | .and_then(|l| l.lifetime_token()) | 362 | label: e |
359 | .map(|l| Name::new_lifetime(&l)), | 363 | .label() |
360 | }, | 364 | .and_then(|l| l.lifetime_token()) |
361 | syntax_ptr, | 365 | .map(|l| Name::new_lifetime(&l)), |
362 | ), match_expr); | 366 | }, |
367 | syntax_ptr, | ||
368 | ), | ||
369 | match_expr | ||
370 | ); | ||
363 | } | 371 | } |
364 | }, | 372 | }, |
365 | }; | 373 | }; |
366 | 374 | ||
367 | track_parent!(self, self.alloc_expr( | 375 | track_parent!( |
368 | Expr::While { | 376 | self, |
369 | condition, | 377 | self.alloc_expr( |
370 | body, | 378 | Expr::While { |
371 | label: e | 379 | condition, |
372 | .label() | 380 | body, |
373 | .and_then(|l| l.lifetime_token()) | 381 | label: e |
374 | .map(|l| Name::new_lifetime(&l)), | 382 | .label() |
375 | }, | 383 | .and_then(|l| l.lifetime_token()) |
376 | syntax_ptr, | 384 | .map(|l| Name::new_lifetime(&l)), |
377 | ), body, condition) | 385 | }, |
386 | syntax_ptr, | ||
387 | ), | ||
388 | body, | ||
389 | condition | ||
390 | ) | ||
378 | } | 391 | } |
379 | ast::Expr::ForExpr(e) => { | 392 | ast::Expr::ForExpr(e) => { |
380 | let iterable = self.collect_expr_opt(e.iterable()); | 393 | let iterable = self.collect_expr_opt(e.iterable()); |
381 | let pat = self.collect_pat_opt(e.pat()); | 394 | let pat = self.collect_pat_opt(e.pat()); |
382 | let body = self.collect_block_opt(e.loop_body()); | 395 | let body = self.collect_block_opt(e.loop_body()); |
383 | track_parent!(self, self.alloc_expr( | 396 | track_parent!( |
384 | Expr::For { | 397 | self, |
385 | iterable, | 398 | self.alloc_expr( |
386 | pat, | 399 | Expr::For { |
387 | body, | 400 | iterable, |
388 | label: e | 401 | pat, |
389 | .label() | 402 | body, |
390 | .and_then(|l| l.lifetime_token()) | 403 | label: e |
391 | .map(|l| Name::new_lifetime(&l)), | 404 | .label() |
392 | }, | 405 | .and_then(|l| l.lifetime_token()) |
393 | syntax_ptr, | 406 | .map(|l| Name::new_lifetime(&l)), |
394 | ), iterable, body) | 407 | }, |
408 | syntax_ptr, | ||
409 | ), | ||
410 | iterable, | ||
411 | body | ||
412 | ) | ||
395 | } | 413 | } |
396 | ast::Expr::CallExpr(e) => { | 414 | ast::Expr::CallExpr(e) => { |
397 | let callee = self.collect_expr_opt(e.expr()); | 415 | let callee = self.collect_expr_opt(e.expr()); |
@@ -461,10 +479,10 @@ impl ExprCollector<'_> { | |||
461 | .unwrap_or(Expr::Missing); | 479 | .unwrap_or(Expr::Missing); |
462 | self.alloc_expr(path, syntax_ptr) | 480 | self.alloc_expr(path, syntax_ptr) |
463 | } | 481 | } |
464 | ast::Expr::ContinueExpr(e) => (self.alloc_expr( | 482 | ast::Expr::ContinueExpr(e) => self.alloc_expr( |
465 | Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, | 483 | Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, |
466 | syntax_ptr, | 484 | syntax_ptr, |
467 | ), vec![]), | 485 | ), |
468 | ast::Expr::BreakExpr(e) => { | 486 | ast::Expr::BreakExpr(e) => { |
469 | let expr = e.expr().map(|e| self.collect_expr(e)); | 487 | let expr = e.expr().map(|e| self.collect_expr(e)); |
470 | track_parent!(self, self.alloc_expr( | 488 | track_parent!(self, self.alloc_expr( |