aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
authorPaul Daniel Faria <[email protected]>2020-06-26 02:34:39 +0100
committerPaul Daniel Faria <[email protected]>2020-06-26 16:11:51 +0100
commit76755ce176222128c354647941cea65ac30ff4bd (patch)
treec79df926033b6eb94522c5dcf6f17734640eeb13 /crates/ra_hir_def/src/nameres
parentde9e964e4ac21897bd48adbe37f379d74422919f (diff)
Split glob import map to per-ns, switch ExprCollector to use a simpler push_res
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index f7b99e0be..e74f67b3d 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -20,7 +20,7 @@ use test_utils::mark;
20use crate::{ 20use crate::{
21 attr::Attrs, 21 attr::Attrs,
22 db::DefDatabase, 22 db::DefDatabase,
23 item_scope::ImportType, 23 item_scope::{ImportType, PerNsGlobImports},
24 item_tree::{ 24 item_tree::{
25 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, Mod, ModItem, ModKind, StructDefKind, 25 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, Mod, ModItem, ModKind, StructDefKind,
26 }, 26 },
@@ -81,7 +81,7 @@ pub(super) fn collect_defs(db: &dyn DefDatabase, mut def_map: CrateDefMap) -> Cr
81 mod_dirs: FxHashMap::default(), 81 mod_dirs: FxHashMap::default(),
82 cfg_options, 82 cfg_options,
83 proc_macros, 83 proc_macros,
84 import_types: FxHashMap::default(), 84 from_glob_import: Default::default(),
85 }; 85 };
86 collector.collect(); 86 collector.collect();
87 collector.finish() 87 collector.finish()
@@ -188,7 +188,7 @@ struct DefCollector<'a> {
188 mod_dirs: FxHashMap<LocalModuleId, ModDir>, 188 mod_dirs: FxHashMap<LocalModuleId, ModDir>,
189 cfg_options: &'a CfgOptions, 189 cfg_options: &'a CfgOptions,
190 proc_macros: Vec<(Name, ProcMacroExpander)>, 190 proc_macros: Vec<(Name, ProcMacroExpander)>,
191 import_types: FxHashMap<Name, ImportType>, 191 from_glob_import: PerNsGlobImports,
192} 192}
193 193
194impl DefCollector<'_> { 194impl DefCollector<'_> {
@@ -595,9 +595,9 @@ impl DefCollector<'_> {
595 let scope = &mut self.def_map.modules[module_id].scope; 595 let scope = &mut self.def_map.modules[module_id].scope;
596 let mut changed = false; 596 let mut changed = false;
597 for (name, res) in resolutions { 597 for (name, res) in resolutions {
598 changed |= scope.push_res( 598 changed |= scope.push_res_with_import(
599 &mut self.import_types, 599 &mut self.from_glob_import,
600 name.clone(), 600 (module_id, name.clone()),
601 res.with_visibility(vis), 601 res.with_visibility(vis),
602 import_type, 602 import_type,
603 ); 603 );
@@ -1184,7 +1184,7 @@ mod tests {
1184 mod_dirs: FxHashMap::default(), 1184 mod_dirs: FxHashMap::default(),
1185 cfg_options: &CfgOptions::default(), 1185 cfg_options: &CfgOptions::default(),
1186 proc_macros: Default::default(), 1186 proc_macros: Default::default(),
1187 import_types: FxHashMap::default(), 1187 from_glob_import: Default::default(),
1188 }; 1188 };
1189 collector.collect(); 1189 collector.collect();
1190 collector.def_map 1190 collector.def_map