aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r--crates/ra_hir/src/expr.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index 51913d37b..9d9769859 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -6,7 +6,7 @@ use rustc_hash::FxHashMap;
6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; 6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
7use ra_syntax::{ 7use ra_syntax::{
8 SyntaxNodePtr, AstPtr, AstNode, 8 SyntaxNodePtr, AstPtr, AstNode,
9 ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner}, 9 ast::{self, TryBlockBodyOwner, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner},
10}; 10};
11 11
12use crate::{ 12use crate::{
@@ -216,6 +216,9 @@ pub enum Expr {
216 Try { 216 Try {
217 expr: ExprId, 217 expr: ExprId,
218 }, 218 },
219 TryBlock {
220 body: ExprId,
221 },
219 Cast { 222 Cast {
220 expr: ExprId, 223 expr: ExprId,
221 type_ref: TypeRef, 224 type_ref: TypeRef,
@@ -299,6 +302,7 @@ impl Expr {
299 f(*expr); 302 f(*expr);
300 } 303 }
301 } 304 }
305 Expr::TryBlock { body } => f(*body),
302 Expr::Loop { body } => f(*body), 306 Expr::Loop { body } => f(*body),
303 Expr::While { condition, body } => { 307 Expr::While { condition, body } => {
304 f(*condition); 308 f(*condition);
@@ -578,6 +582,10 @@ where
578 self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr) 582 self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr)
579 } 583 }
580 } 584 }
585 ast::ExprKind::TryBlockExpr(e) => {
586 let body = self.collect_block_opt(e.try_body());
587 self.alloc_expr(Expr::TryBlock { body }, syntax_ptr)
588 }
581 ast::ExprKind::BlockExpr(e) => self.collect_block_opt(e.block()), 589 ast::ExprKind::BlockExpr(e) => self.collect_block_opt(e.block()),
582 ast::ExprKind::LoopExpr(e) => { 590 ast::ExprKind::LoopExpr(e) => {
583 let body = self.collect_block_opt(e.loop_body()); 591 let body = self.collect_block_opt(e.loop_body());