diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 12:27:50 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 12:27:50 +0100 |
commit | dac6adbef90286f053f034eace9df65d6a19c0ff (patch) | |
tree | fe3376a1bdd3649240465fb6711f4b21cffd47f1 /crates/ra_hir/src/expr.rs | |
parent | 6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (diff) | |
parent | bacf926a77a3e4040ccaf64cce1b1517e41a8d47 (diff) |
Merge #1562
1562: Continue support for .await r=matklad a=unrealhoang
- add await expr to ast and HIR Expr
- infer type for `.await`
Co-authored-by: Unreal Hoang <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 6eed67f50..4dcea19a9 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -220,6 +220,9 @@ pub enum Expr { | |||
220 | expr: ExprId, | 220 | expr: ExprId, |
221 | name: Name, | 221 | name: Name, |
222 | }, | 222 | }, |
223 | Await { | ||
224 | expr: ExprId, | ||
225 | }, | ||
223 | Try { | 226 | Try { |
224 | expr: ExprId, | 227 | expr: ExprId, |
225 | }, | 228 | }, |
@@ -359,6 +362,7 @@ impl Expr { | |||
359 | f(*rhs); | 362 | f(*rhs); |
360 | } | 363 | } |
361 | Expr::Field { expr, .. } | 364 | Expr::Field { expr, .. } |
365 | | Expr::Await { expr } | ||
362 | | Expr::Try { expr } | 366 | | Expr::Try { expr } |
363 | | Expr::Cast { expr, .. } | 367 | | Expr::Cast { expr, .. } |
364 | | Expr::Ref { expr, .. } | 368 | | Expr::Ref { expr, .. } |
@@ -729,6 +733,10 @@ where | |||
729 | }; | 733 | }; |
730 | self.alloc_expr(Expr::Field { expr, name }, syntax_ptr) | 734 | self.alloc_expr(Expr::Field { expr, name }, syntax_ptr) |
731 | } | 735 | } |
736 | ast::ExprKind::AwaitExpr(e) => { | ||
737 | let expr = self.collect_expr_opt(e.expr()); | ||
738 | self.alloc_expr(Expr::Await { expr }, syntax_ptr) | ||
739 | } | ||
732 | ast::ExprKind::TryExpr(e) => { | 740 | ast::ExprKind::TryExpr(e) => { |
733 | let expr = self.collect_expr_opt(e.expr()); | 741 | let expr = self.collect_expr_opt(e.expr()); |
734 | self.alloc_expr(Expr::Try { expr }, syntax_ptr) | 742 | self.alloc_expr(Expr::Try { expr }, syntax_ptr) |