Privatize modules
This commit is contained in:
parent
9c7a2aef30
commit
a28907af8c
@ -81,7 +81,7 @@ pub fn diagnostics(&self) -> String {
|
||||
let crate_graph = self.crate_graph();
|
||||
for krate in crate_graph.iter().next() {
|
||||
let crate_def_map = self.crate_def_map(krate);
|
||||
for (module_id, _) in crate_def_map.modules.iter() {
|
||||
for module_id in crate_def_map.modules() {
|
||||
let module_id = ModuleId { krate, module_id };
|
||||
let module = crate::Module::from(module_id);
|
||||
module.diagnostics(
|
||||
|
@ -87,7 +87,7 @@ pub struct CrateDefMap {
|
||||
prelude: Option<ModuleId>,
|
||||
extern_prelude: FxHashMap<Name, ModuleDefId>,
|
||||
root: CrateModuleId,
|
||||
pub modules: Arena<CrateModuleId, ModuleData>,
|
||||
modules: Arena<CrateModuleId, ModuleData>,
|
||||
|
||||
/// Some macros are not well-behavior, which leads to infinite loop
|
||||
/// e.g. macro_rules! foo { ($ty:ty) => { foo!($ty); } }
|
||||
@ -259,6 +259,10 @@ pub fn resolve_path(
|
||||
(res.resolved_def, res.segment_index)
|
||||
}
|
||||
|
||||
pub fn modules(&self) -> impl Iterator<Item = CrateModuleId> + '_ {
|
||||
self.modules.iter().map(|(id, _data)| id)
|
||||
}
|
||||
|
||||
pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = CrateModuleId> + '_ {
|
||||
self.modules
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user