aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/expr.rs')
-rw-r--r--crates/hir_def/src/expr.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs
index b080f1553..6a481769d 100644
--- a/crates/hir_def/src/expr.rs
+++ b/crates/hir_def/src/expr.rs
@@ -120,6 +120,9 @@ pub enum Expr {
120 Async { 120 Async {
121 body: ExprId, 121 body: ExprId,
122 }, 122 },
123 Const {
124 body: ExprId,
125 },
123 Cast { 126 Cast {
124 expr: ExprId, 127 expr: ExprId,
125 type_ref: TypeRef, 128 type_ref: TypeRef,
@@ -259,7 +262,10 @@ impl Expr {
259 f(*expr); 262 f(*expr);
260 } 263 }
261 } 264 }
262 Expr::TryBlock { body } | Expr::Unsafe { body } | Expr::Async { body } => f(*body), 265 Expr::TryBlock { body }
266 | Expr::Unsafe { body }
267 | Expr::Async { body }
268 | Expr::Const { body } => f(*body),
263 Expr::Loop { body, .. } => f(*body), 269 Expr::Loop { body, .. } => f(*body),
264 Expr::While { condition, body, .. } => { 270 Expr::While { condition, body, .. } => {
265 f(*condition); 271 f(*condition);
@@ -405,12 +411,18 @@ pub enum Pat {
405 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> }, 411 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> },
406 Ref { pat: PatId, mutability: Mutability }, 412 Ref { pat: PatId, mutability: Mutability },
407 Box { inner: PatId }, 413 Box { inner: PatId },
414 ConstBlock(ExprId),
408} 415}
409 416
410impl Pat { 417impl Pat {
411 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) { 418 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) {
412 match self { 419 match self {
413 Pat::Range { .. } | Pat::Lit(..) | Pat::Path(..) | Pat::Wild | Pat::Missing => {} 420 Pat::Range { .. }
421 | Pat::Lit(..)
422 | Pat::Path(..)
423 | Pat::ConstBlock(..)
424 | Pat::Wild
425 | Pat::Missing => {}
414 Pat::Bind { subpat, .. } => { 426 Pat::Bind { subpat, .. } => {
415 subpat.iter().copied().for_each(f); 427 subpat.iter().copied().for_each(f);
416 } 428 }