diff options
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 13 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 9 |
2 files changed, 8 insertions, 14 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 3ea8d592c..c5b73cfbe 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -6,7 +6,7 @@ use ra_db::FileId; | |||
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | Function, Module, Struct, Enum, Const, Static, Trait, TypeAlias, | 8 | Function, Module, Struct, Enum, Const, Static, Trait, TypeAlias, |
9 | PersistentHirDatabase, HirFileId, Name, Path, Problem, Crate, | 9 | DefDatabase, HirFileId, Name, Path, Problem, Crate, |
10 | KnownName, | 10 | KnownName, |
11 | nameres::{Resolution, PerNs, ModuleDef, ReachedFixedPoint, ResolveMode, raw}, | 11 | nameres::{Resolution, PerNs, ModuleDef, ReachedFixedPoint, ResolveMode, raw}, |
12 | ids::{AstItemDef, LocationCtx, MacroCallLoc, SourceItemId, MacroCallId}, | 12 | ids::{AstItemDef, LocationCtx, MacroCallLoc, SourceItemId, MacroCallId}, |
@@ -14,10 +14,7 @@ use crate::{ | |||
14 | 14 | ||
15 | use super::{CrateDefMap, CrateModuleId, ModuleData, CrateMacroId}; | 15 | use super::{CrateDefMap, CrateModuleId, ModuleData, CrateMacroId}; |
16 | 16 | ||
17 | pub(super) fn collect_defs( | 17 | pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { |
18 | db: &impl PersistentHirDatabase, | ||
19 | mut def_map: CrateDefMap, | ||
20 | ) -> CrateDefMap { | ||
21 | // populate external prelude | 18 | // populate external prelude |
22 | for dep in def_map.krate.dependencies(db) { | 19 | for dep in def_map.krate.dependencies(db) { |
23 | log::debug!("crate dep {:?} -> {:?}", dep.name, dep.krate); | 20 | log::debug!("crate dep {:?} -> {:?}", dep.name, dep.krate); |
@@ -57,7 +54,7 @@ struct DefCollector<DB> { | |||
57 | 54 | ||
58 | impl<'a, DB> DefCollector<&'a DB> | 55 | impl<'a, DB> DefCollector<&'a DB> |
59 | where | 56 | where |
60 | DB: PersistentHirDatabase, | 57 | DB: DefDatabase, |
61 | { | 58 | { |
62 | fn collect(&mut self) { | 59 | fn collect(&mut self) { |
63 | let crate_graph = self.db.crate_graph(); | 60 | let crate_graph = self.db.crate_graph(); |
@@ -370,7 +367,7 @@ struct ModCollector<'a, D> { | |||
370 | 367 | ||
371 | impl<DB> ModCollector<'_, &'_ mut DefCollector<&'_ DB>> | 368 | impl<DB> ModCollector<'_, &'_ mut DefCollector<&'_ DB>> |
372 | where | 369 | where |
373 | DB: PersistentHirDatabase, | 370 | DB: DefDatabase, |
374 | { | 371 | { |
375 | fn collect(&mut self, items: &[raw::RawItem]) { | 372 | fn collect(&mut self, items: &[raw::RawItem]) { |
376 | for item in items { | 373 | for item in items { |
@@ -523,7 +520,7 @@ fn is_macro_rules(path: &Path) -> bool { | |||
523 | } | 520 | } |
524 | 521 | ||
525 | fn resolve_submodule( | 522 | fn resolve_submodule( |
526 | db: &impl PersistentHirDatabase, | 523 | db: &impl DefDatabase, |
527 | file_id: HirFileId, | 524 | file_id: HirFileId, |
528 | name: &Name, | 525 | name: &Name, |
529 | is_root: bool, | 526 | is_root: bool, |
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 3226bbf0d..f8ba398ec 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs | |||
@@ -12,7 +12,7 @@ use ra_syntax::{ | |||
12 | }; | 12 | }; |
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | PersistentHirDatabase, Name, AsName, Path, HirFileId, ModuleSource, | 15 | DefDatabase, Name, AsName, Path, HirFileId, ModuleSource, |
16 | ids::{SourceFileItemId, SourceFileItems}, | 16 | ids::{SourceFileItemId, SourceFileItems}, |
17 | }; | 17 | }; |
18 | 18 | ||
@@ -47,15 +47,12 @@ impl ImportSourceMap { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | impl RawItems { | 49 | impl RawItems { |
50 | pub(crate) fn raw_items_query( | 50 | pub(crate) fn raw_items_query(db: &impl DefDatabase, file_id: FileId) -> Arc<RawItems> { |
51 | db: &impl PersistentHirDatabase, | ||
52 | file_id: FileId, | ||
53 | ) -> Arc<RawItems> { | ||
54 | db.raw_items_with_source_map(file_id).0 | 51 | db.raw_items_with_source_map(file_id).0 |
55 | } | 52 | } |
56 | 53 | ||
57 | pub(crate) fn raw_items_with_source_map_query( | 54 | pub(crate) fn raw_items_with_source_map_query( |
58 | db: &impl PersistentHirDatabase, | 55 | db: &impl DefDatabase, |
59 | file_id: FileId, | 56 | file_id: FileId, |
60 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>) { | 57 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>) { |
61 | let mut collector = RawItemsCollector { | 58 | let mut collector = RawItemsCollector { |