diff options
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r-- | crates/hir_def/src/nameres.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index 34ff07f3c..f92232eb3 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs | |||
@@ -337,6 +337,12 @@ impl DefMap { | |||
337 | None | 337 | None |
338 | } | 338 | } |
339 | 339 | ||
340 | /// If this `DefMap` is for a block expression, returns the module containing the block (which | ||
341 | /// might again be a block, or a module inside a block). | ||
342 | pub fn parent(&self) -> Option<ModuleId> { | ||
343 | Some(self.block?.parent) | ||
344 | } | ||
345 | |||
340 | // FIXME: this can use some more human-readable format (ideally, an IR | 346 | // FIXME: this can use some more human-readable format (ideally, an IR |
341 | // even), as this should be a great debugging aid. | 347 | // even), as this should be a great debugging aid. |
342 | pub fn dump(&self, db: &dyn DefDatabase) -> String { | 348 | pub fn dump(&self, db: &dyn DefDatabase) -> String { |