diff options
author | Aleksey Kladov <[email protected]> | 2018-11-20 21:39:50 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-20 21:39:50 +0000 |
commit | 36aad851383c7fd1ca5ffaa99ba8cc96b85378c1 (patch) | |
tree | 512fce887b8d79fa2d6442dde5c5b0262ac4757f /crates/ra_analysis/src/descriptors/module | |
parent | 9bb11aee44f377fdf2ce7bed5c09ccbcf30f9b57 (diff) |
add item map query
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/mod.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/nameres.rs | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs index 2d0bfa64c..124926a40 100644 --- a/crates/ra_analysis/src/descriptors/module/mod.rs +++ b/crates/ra_analysis/src/descriptors/module/mod.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | pub(super) mod imp; | 1 | pub(super) mod imp; |
2 | mod scope; | 2 | mod scope; |
3 | mod nameres; | 3 | pub(super) mod nameres; |
4 | 4 | ||
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/descriptors/module/nameres.rs index 058e64ad1..657e5bd1c 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/descriptors/module/nameres.rs | |||
@@ -9,6 +9,7 @@ use ra_syntax::{ | |||
9 | }; | 9 | }; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | Cancelable, | ||
12 | loc2id::{DefId, DefLoc}, | 13 | loc2id::{DefId, DefLoc}, |
13 | descriptors::{ | 14 | descriptors::{ |
14 | DescriptorDatabase, | 15 | DescriptorDatabase, |
@@ -45,12 +46,21 @@ enum PathKind { | |||
45 | Crate, | 46 | Crate, |
46 | } | 47 | } |
47 | 48 | ||
48 | #[derive(Debug)] | 49 | pub(crate) fn item_map( |
49 | struct ItemMap { | 50 | db: &impl DescriptorDatabase, |
51 | source_root: SourceRootId, | ||
52 | ) -> Cancelable<Arc<ItemMap>> { | ||
53 | unimplemented!() | ||
54 | } | ||
55 | |||
56 | /// Item map is the result of the name resolution. Item map contains, for each | ||
57 | /// module, the set of visible items. | ||
58 | #[derive(Debug, PartialEq, Eq)] | ||
59 | pub(crate) struct ItemMap { | ||
50 | per_module: FxHashMap<ModuleId, ModuleItems>, | 60 | per_module: FxHashMap<ModuleId, ModuleItems>, |
51 | } | 61 | } |
52 | 62 | ||
53 | #[derive(Debug, Default)] | 63 | #[derive(Debug, Default, PartialEq, Eq)] |
54 | struct ModuleItems { | 64 | struct ModuleItems { |
55 | items: FxHashMap<SmolStr, Resolution>, | 65 | items: FxHashMap<SmolStr, Resolution>, |
56 | import_resolutions: FxHashMap<LocalSyntaxPtr, DefId>, | 66 | import_resolutions: FxHashMap<LocalSyntaxPtr, DefId>, |
@@ -58,7 +68,7 @@ struct ModuleItems { | |||
58 | 68 | ||
59 | /// Resolution is basically `DefId` atm, but it should account for stuff like | 69 | /// Resolution is basically `DefId` atm, but it should account for stuff like |
60 | /// multiple namespaces, ambiguity and errors. | 70 | /// multiple namespaces, ambiguity and errors. |
61 | #[derive(Debug, Clone)] | 71 | #[derive(Debug, Clone, PartialEq, Eq)] |
62 | struct Resolution { | 72 | struct Resolution { |
63 | /// None for unresolved | 73 | /// None for unresolved |
64 | def_id: Option<DefId>, | 74 | def_id: Option<DefId>, |