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 e5d740a36..3bba30397 100644
--- a/crates/hir_def/src/expr.rs
+++ b/crates/hir_def/src/expr.rs
@@ -114,6 +114,9 @@ pub enum Expr {
114 Async { 114 Async {
115 body: ExprId, 115 body: ExprId,
116 }, 116 },
117 Const {
118 body: ExprId,
119 },
117 Cast { 120 Cast {
118 expr: ExprId, 121 expr: ExprId,
119 type_ref: TypeRef, 122 type_ref: TypeRef,
@@ -253,7 +256,10 @@ impl Expr {
253 f(*expr); 256 f(*expr);
254 } 257 }
255 } 258 }
256 Expr::TryBlock { body } | Expr::Unsafe { body } | Expr::Async { body } => f(*body), 259 Expr::TryBlock { body }
260 | Expr::Unsafe { body }
261 | Expr::Async { body }
262 | Expr::Const { body } => f(*body),
257 Expr::Loop { body, .. } => f(*body), 263 Expr::Loop { body, .. } => f(*body),
258 Expr::While { condition, body, .. } => { 264 Expr::While { condition, body, .. } => {
259 f(*condition); 265 f(*condition);
@@ -399,12 +405,18 @@ pub enum Pat {
399 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> }, 405 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> },
400 Ref { pat: PatId, mutability: Mutability }, 406 Ref { pat: PatId, mutability: Mutability },
401 Box { inner: PatId }, 407 Box { inner: PatId },
408 ConstBlock(ExprId),
402} 409}
403 410
404impl Pat { 411impl Pat {
405 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) { 412 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) {
406 match self { 413 match self {
407 Pat::Range { .. } | Pat::Lit(..) | Pat::Path(..) | Pat::Wild | Pat::Missing => {} 414 Pat::Range { .. }
415 | Pat::Lit(..)
416 | Pat::Path(..)
417 | Pat::ConstBlock(..)
418 | Pat::Wild
419 | Pat::Missing => {}
408 Pat::Bind { subpat, .. } => { 420 Pat::Bind { subpat, .. } => {
409 subpat.iter().copied().for_each(f); 421 subpat.iter().copied().for_each(f);
410 } 422 }