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.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 769a557ad..c3d3efc6b 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -75,8 +75,8 @@ use crate::{
75/// Contains all top-level defs from a macro-expanded crate 75/// Contains all top-level defs from a macro-expanded crate
76#[derive(Debug, PartialEq, Eq)] 76#[derive(Debug, PartialEq, Eq)]
77pub struct DefMap { 77pub struct DefMap {
78 pub root: LocalModuleId, 78 root: LocalModuleId,
79 pub modules: Arena<ModuleData>, 79 modules: Arena<ModuleData>,
80 pub(crate) krate: CrateId, 80 pub(crate) krate: CrateId,
81 /// The prelude module for this crate. This either comes from an import 81 /// The prelude module for this crate. This either comes from an import
82 /// marked with the `prelude_import` attribute, or (in the normal case) from 82 /// marked with the `prelude_import` attribute, or (in the normal case) from
@@ -208,6 +208,14 @@ impl DefMap {
208 .map(|(id, _data)| id) 208 .map(|(id, _data)| id)
209 } 209 }
210 210
211 pub fn modules(&self) -> impl Iterator<Item = (LocalModuleId, &ModuleData)> + '_ {
212 self.modules.iter()
213 }
214
215 pub fn root(&self) -> LocalModuleId {
216 self.root
217 }
218
211 pub(crate) fn resolve_path( 219 pub(crate) fn resolve_path(
212 &self, 220 &self,
213 db: &dyn DefDatabase, 221 db: &dyn DefDatabase,