diff options
author | Aleksey Kladov <[email protected]> | 2019-11-15 07:42:54 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-15 07:42:54 +0000 |
commit | a28907af8ca93077601053cf168ac2429855c394 (patch) | |
tree | e4930115d3f0249ea3f6f899a9b10b2a62a12bef /crates/ra_hir_def | |
parent | 9c7a2aef30cb35347af646dea5a5611af1224676 (diff) |
Privatize modules
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 6 |
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() |