aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorUnreal Hoang <[email protected]>2019-07-20 11:35:49 +0100
committerUnreal Hoang <[email protected]>2019-07-20 11:35:49 +0100
commit5ac9f5cdc7a88dcb9545d2e150780c8edee83b06 (patch)
tree7893e33a7b7cf986b14d60fd1cf50c03d2403a24 /crates/ra_hir
parent2830d1376b05794c7bf1467fe52ad3bc0eb4ca41 (diff)
add await expr to ast
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/expr.rs8
-rw-r--r--crates/ra_hir/src/ty/infer.rs3
2 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index 66cb9633b..7e3e0a07d 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)
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 0e030576d..6eae595a9 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -1114,6 +1114,9 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1114 .unwrap_or(Ty::Unknown); 1114 .unwrap_or(Ty::Unknown);
1115 self.insert_type_vars(ty) 1115 self.insert_type_vars(ty)
1116 } 1116 }
1117 Expr::Await { .. } => {
1118 Ty::Unknown
1119 }
1117 Expr::Try { expr } => { 1120 Expr::Try { expr } => {
1118 let inner_ty = self.infer_expr(*expr, &Expectation::none()); 1121 let inner_ty = self.infer_expr(*expr, &Expectation::none());
1119 let ty = match self.resolve_ops_try_ok() { 1122 let ty = match self.resolve_ops_try_ok() {