aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r--crates/hir_def/src/nameres.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 199771e9a..005b36e02 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -289,6 +289,17 @@ impl DefMap {
289 (res.resolved_def, res.segment_index) 289 (res.resolved_def, res.segment_index)
290 } 290 }
291 291
292 /// Iterates over the containing `DefMap`s, if `self` is a `DefMap` corresponding to a block
293 /// expression.
294 fn ancestor_maps(
295 &self,
296 local_mod: LocalModuleId,
297 ) -> impl Iterator<Item = (&DefMap, LocalModuleId)> {
298 std::iter::successors(Some((self, local_mod)), |(map, _)| {
299 map.block.as_ref().map(|block| (&*block.parent, block.parent_module))
300 })
301 }
302
292 // FIXME: this can use some more human-readable format (ideally, an IR 303 // FIXME: this can use some more human-readable format (ideally, an IR
293 // even), as this should be a great debugging aid. 304 // even), as this should be a great debugging aid.
294 pub fn dump(&self) -> String { 305 pub fn dump(&self) -> String {