aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/nameres.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index 1331fbe30..5fc592150 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -87,7 +87,7 @@ pub struct CrateDefMap {
87 prelude: Option<ModuleId>, 87 prelude: Option<ModuleId>,
88 extern_prelude: FxHashMap<Name, ModuleDefId>, 88 extern_prelude: FxHashMap<Name, ModuleDefId>,
89 root: CrateModuleId, 89 root: CrateModuleId,
90 pub modules: Arena<CrateModuleId, ModuleData>, 90 modules: Arena<CrateModuleId, ModuleData>,
91 91
92 /// Some macros are not well-behavior, which leads to infinite loop 92 /// Some macros are not well-behavior, which leads to infinite loop
93 /// e.g. macro_rules! foo { ($ty:ty) => { foo!($ty); } } 93 /// e.g. macro_rules! foo { ($ty:ty) => { foo!($ty); } }
@@ -259,6 +259,10 @@ impl CrateDefMap {
259 (res.resolved_def, res.segment_index) 259 (res.resolved_def, res.segment_index)
260 } 260 }
261 261
262 pub fn modules(&self) -> impl Iterator<Item = CrateModuleId> + '_ {
263 self.modules.iter().map(|(id, _data)| id)
264 }
265
262 pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = CrateModuleId> + '_ { 266 pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = CrateModuleId> + '_ {
263 self.modules 267 self.modules
264 .iter() 268 .iter()