Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store.rs')
-rw-r--r--crates/hir-def/src/expr_store.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir-def/src/expr_store.rs b/crates/hir-def/src/expr_store.rs
index 75278f778b..497ed7d37f 100644
--- a/crates/hir-def/src/expr_store.rs
+++ b/crates/hir-def/src/expr_store.rs
@@ -675,6 +675,9 @@ impl ExpressionStore {
f(*expr);
arms.iter().for_each(|arm| {
f(arm.expr);
+ if let Some(guard) = arm.guard {
+ f(guard);
+ }
self.walk_exprs_in_pat(arm.pat, &mut f);
});
}
@@ -926,6 +929,13 @@ impl ExpressionStore {
// We keep the async closure exactly one expr before.
ExprId::from_raw(la_arena::RawIdx::from_u32(coroutine_closure.into_raw().into_u32() - 1))
}
+
+ /// The opposite of [`Self::coroutine_for_closure()`].
+ #[inline]
+ pub fn closure_for_coroutine(coroutine: ExprId) -> ExprId {
+ // We keep the async closure exactly one expr before.
+ ExprId::from_raw(la_arena::RawIdx::from_u32(coroutine.into_raw().into_u32() + 1))
+ }
}
impl Index<ExprId> for ExpressionStore {