diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 5919771b0..2359386c2 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs | |||
@@ -80,16 +80,16 @@ use crate::{ | |||
80 | /// Contains all top-level defs from a macro-expanded crate | 80 | /// Contains all top-level defs from a macro-expanded crate |
81 | #[derive(Debug, PartialEq, Eq)] | 81 | #[derive(Debug, PartialEq, Eq)] |
82 | pub struct CrateDefMap { | 82 | pub struct CrateDefMap { |
83 | krate: CrateId, | 83 | pub root: LocalModuleId, |
84 | edition: Edition, | 84 | pub modules: Arena<LocalModuleId, ModuleData>, |
85 | pub(crate) krate: CrateId, | ||
85 | /// The prelude module for this crate. This either comes from an import | 86 | /// The prelude module for this crate. This either comes from an import |
86 | /// marked with the `prelude_import` attribute, or (in the normal case) from | 87 | /// marked with the `prelude_import` attribute, or (in the normal case) from |
87 | /// a dependency (`std` or `core`). | 88 | /// a dependency (`std` or `core`). |
88 | prelude: Option<ModuleId>, | 89 | pub(crate) prelude: Option<ModuleId>, |
89 | extern_prelude: FxHashMap<Name, ModuleDefId>, | 90 | pub(crate) extern_prelude: FxHashMap<Name, ModuleDefId>, |
90 | root: LocalModuleId, | ||
91 | modules: Arena<LocalModuleId, ModuleData>, | ||
92 | 91 | ||
92 | edition: Edition, | ||
93 | diagnostics: Vec<DefDiagnostic>, | 93 | diagnostics: Vec<DefDiagnostic>, |
94 | } | 94 | } |
95 | 95 | ||
@@ -229,22 +229,6 @@ impl CrateDefMap { | |||
229 | Arc::new(def_map) | 229 | Arc::new(def_map) |
230 | } | 230 | } |
231 | 231 | ||
232 | pub fn krate(&self) -> CrateId { | ||
233 | self.krate | ||
234 | } | ||
235 | |||
236 | pub fn root(&self) -> LocalModuleId { | ||
237 | self.root | ||
238 | } | ||
239 | |||
240 | pub fn prelude(&self) -> Option<ModuleId> { | ||
241 | self.prelude | ||
242 | } | ||
243 | |||
244 | pub fn extern_prelude(&self) -> &FxHashMap<Name, ModuleDefId> { | ||
245 | &self.extern_prelude | ||
246 | } | ||
247 | |||
248 | pub fn add_diagnostics( | 232 | pub fn add_diagnostics( |
249 | &self, | 233 | &self, |
250 | db: &impl DefDatabase, | 234 | db: &impl DefDatabase, |
@@ -254,10 +238,6 @@ impl CrateDefMap { | |||
254 | self.diagnostics.iter().for_each(|it| it.add_to(db, module, sink)) | 238 | self.diagnostics.iter().for_each(|it| it.add_to(db, module, sink)) |
255 | } | 239 | } |
256 | 240 | ||
257 | pub fn modules(&self) -> impl Iterator<Item = LocalModuleId> + '_ { | ||
258 | self.modules.iter().map(|(id, _data)| id) | ||
259 | } | ||
260 | |||
261 | pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = LocalModuleId> + '_ { | 241 | pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = LocalModuleId> + '_ { |
262 | self.modules | 242 | self.modules |
263 | .iter() | 243 | .iter() |