From 158b1cb524d8e07aa7a6ec2342bca2ce4667d316 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Nov 2019 16:49:53 +0300 Subject: Rename CrateModuleId --- crates/ra_hir_def/src/nameres/collector.rs | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'crates/ra_hir_def/src/nameres/collector.rs') diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 4a671b8f3..5f7697f63 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -19,9 +19,9 @@ use crate::{ per_ns::PerNs, raw, CrateDefMap, ModuleData, Resolution, ResolveMode, }, path::{Path, PathKind}, - AdtId, AstId, AstItemDef, ConstLoc, ContainerId, CrateModuleId, EnumId, EnumVariantId, - FunctionLoc, ImplId, Intern, LocalImportId, LocationCtx, ModuleDefId, ModuleId, StaticId, - StructId, StructOrUnionId, TraitId, TypeAliasLoc, UnionId, + AdtId, AstId, AstItemDef, ConstLoc, ContainerId, EnumId, EnumVariantId, FunctionLoc, ImplId, + Intern, LocalImportId, LocalModuleId, LocationCtx, ModuleDefId, ModuleId, StaticId, StructId, + StructOrUnionId, TraitId, TypeAliasLoc, UnionId, }; pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { @@ -94,10 +94,10 @@ impl MacroStackMonitor { struct DefCollector<'a, DB> { db: &'a DB, def_map: CrateDefMap, - glob_imports: FxHashMap>, - unresolved_imports: Vec<(CrateModuleId, LocalImportId, raw::ImportData)>, - unexpanded_macros: Vec<(CrateModuleId, AstId, Path)>, - mod_dirs: FxHashMap, + glob_imports: FxHashMap>, + unresolved_imports: Vec<(LocalModuleId, LocalImportId, raw::ImportData)>, + unexpanded_macros: Vec<(LocalModuleId, AstId, Path)>, + mod_dirs: FxHashMap, /// Some macro use `$tt:tt which mean we have to handle the macro perfectly /// To prevent stack overflow, we add a deep counter here for prevent that. @@ -173,7 +173,7 @@ where /// ``` fn define_macro( &mut self, - module_id: CrateModuleId, + module_id: LocalModuleId, name: Name, macro_: MacroDefId, export: bool, @@ -200,7 +200,7 @@ where /// the definition of current module. /// And also, `macro_use` on a module will import all legacy macros visable inside to /// current legacy scope, with possible shadowing. - fn define_legacy_macro(&mut self, module_id: CrateModuleId, name: Name, macro_: MacroDefId) { + fn define_legacy_macro(&mut self, module_id: LocalModuleId, name: Name, macro_: MacroDefId) { // Always shadowing self.def_map.modules[module_id].scope.legacy_macros.insert(name, macro_); } @@ -208,7 +208,7 @@ where /// Import macros from `#[macro_use] extern crate`. fn import_macros_from_extern_crate( &mut self, - current_module_id: CrateModuleId, + current_module_id: LocalModuleId, import: &raw::ImportData, ) { log::debug!( @@ -235,7 +235,7 @@ where /// Exported macros are just all macros in the root module scope. /// Note that it contains not only all `#[macro_export]` macros, but also all aliases /// created by `use` in the root module, ignoring the visibility of `use`. - fn import_all_macros_exported(&mut self, current_module_id: CrateModuleId, krate: CrateId) { + fn import_all_macros_exported(&mut self, current_module_id: LocalModuleId, krate: CrateId) { let def_map = self.db.crate_def_map(krate); for (name, def) in def_map[def_map.root].scope.macros() { // `macro_use` only bring things into legacy scope. @@ -265,7 +265,7 @@ where fn resolve_import( &self, - module_id: CrateModuleId, + module_id: LocalModuleId, import: &raw::ImportData, ) -> (PerNs, ReachedFixedPoint) { log::debug!("resolving import: {:?} ({:?})", import, self.def_map.edition); @@ -291,7 +291,7 @@ where fn record_resolved_import( &mut self, - module_id: CrateModuleId, + module_id: LocalModuleId, def: PerNs, import_id: LocalImportId, import: &raw::ImportData, @@ -387,7 +387,7 @@ where fn update( &mut self, - module_id: CrateModuleId, + module_id: LocalModuleId, import: Option, resolutions: &[(Name, Resolution)], ) { @@ -396,7 +396,7 @@ where fn update_recursive( &mut self, - module_id: CrateModuleId, + module_id: LocalModuleId, import: Option, resolutions: &[(Name, Resolution)], depth: usize, @@ -484,7 +484,7 @@ where fn collect_macro_expansion( &mut self, - module_id: CrateModuleId, + module_id: LocalModuleId, macro_call_id: MacroCallId, macro_def_id: MacroDefId, ) { @@ -522,7 +522,7 @@ where /// Walks a single module, populating defs, imports and macros struct ModCollector<'a, D> { def_collector: D, - module_id: CrateModuleId, + module_id: LocalModuleId, file_id: HirFileId, raw_items: &'a raw::RawItems, mod_dir: ModDir, @@ -647,7 +647,7 @@ where name: Name, declaration: AstId, definition: Option, - ) -> CrateModuleId { + ) -> LocalModuleId { let modules = &mut self.def_collector.def_map.modules; let res = modules.alloc(ModuleData::default()); modules[res].parent = Some(self.module_id); @@ -772,7 +772,7 @@ where self.def_collector.unexpanded_macros.push((self.module_id, ast_id, path)); } - fn import_all_legacy_macros(&mut self, module_id: CrateModuleId) { + fn import_all_legacy_macros(&mut self, module_id: LocalModuleId) { let macros = self.def_collector.def_map[module_id].scope.legacy_macros.clone(); for (name, macro_) in macros { self.def_collector.define_legacy_macro(self.module_id, name.clone(), macro_); @@ -827,7 +827,7 @@ mod tests { let def_map = { let edition = db.crate_graph().edition(krate); - let mut modules: Arena = Arena::default(); + let mut modules: Arena = Arena::default(); let root = modules.alloc(ModuleData::default()); CrateDefMap { krate, -- cgit v1.2.3