Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body.rs')
-rw-r--r--crates/hir-def/src/body.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/hir-def/src/body.rs b/crates/hir-def/src/body.rs
index 545d2bebf5..c6c1849003 100644
--- a/crates/hir-def/src/body.rs
+++ b/crates/hir-def/src/body.rs
@@ -422,6 +422,13 @@ impl Body {
}
}
+ pub fn walk_child_bindings(&self, pat: PatId, f: &mut impl FnMut(BindingId)) {
+ if let Pat::Bind { id, .. } = self[pat] {
+ f(id)
+ }
+ self[pat].walk_child_pats(|p| self.walk_child_bindings(p, f));
+ }
+
pub fn pretty_print(&self, db: &dyn DefDatabase, owner: DefWithBodyId) -> String {
pretty::print_body_hir(db, self, owner)
}