From dd496223f50232fe98312ee8edc89eb4b5ee3d85 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 15 Dec 2020 19:23:51 +0100 Subject: Node-ify lifetimes --- crates/hir_def/src/body/lower.rs | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'crates/hir_def/src/body') diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 23e2fd764..3b3d74987 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -233,8 +233,7 @@ impl ExprCollector<'_> { let res = self.collect_block(block); match &mut self.body.exprs[res] { Expr::Block { label: block_label, .. } => { - *block_label = - label.lifetime_token().map(|t| Name::new_lifetime(&t)) + *block_label = label.lifetime().map(|t| Name::new_lifetime(&t)) } _ => unreachable!(), } @@ -254,10 +253,7 @@ impl ExprCollector<'_> { self.alloc_expr( Expr::Loop { body, - label: e - .label() - .and_then(|l| l.lifetime_token()) - .map(|l| Name::new_lifetime(&l)), + label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)), }, syntax_ptr, ) @@ -288,7 +284,7 @@ impl ExprCollector<'_> { body: match_expr, label: e .label() - .and_then(|l| l.lifetime_token()) + .and_then(|l| l.lifetime()) .map(|l| Name::new_lifetime(&l)), }, syntax_ptr, @@ -301,10 +297,7 @@ impl ExprCollector<'_> { Expr::While { condition, body, - label: e - .label() - .and_then(|l| l.lifetime_token()) - .map(|l| Name::new_lifetime(&l)), + label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)), }, syntax_ptr, ) @@ -318,10 +311,7 @@ impl ExprCollector<'_> { iterable, pat, body, - label: e - .label() - .and_then(|l| l.lifetime_token()) - .map(|l| Name::new_lifetime(&l)), + label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)), }, syntax_ptr, ) @@ -380,13 +370,13 @@ impl ExprCollector<'_> { self.alloc_expr(path, syntax_ptr) } ast::Expr::ContinueExpr(e) => self.alloc_expr( - Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, + Expr::Continue { label: e.lifetime().map(|l| Name::new_lifetime(&l)) }, syntax_ptr, ), ast::Expr::BreakExpr(e) => { let expr = e.expr().map(|e| self.collect_expr(e)); self.alloc_expr( - Expr::Break { expr, label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, + Expr::Break { expr, label: e.lifetime().map(|l| Name::new_lifetime(&l)) }, syntax_ptr, ) } -- cgit v1.2.3