diff options
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/nameres.rs | 15 | ||||
-rw-r--r-- | crates/ra_analysis/src/loc2id.rs | 18 |
2 files changed, 32 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/descriptors/module/nameres.rs index b65b6adb7..8002656d6 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/descriptors/module/nameres.rs | |||
@@ -7,6 +7,7 @@ use ra_syntax::{ | |||
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
10 | loc2id::DefId, | ||
10 | descriptors::module::ModuleId, | 11 | descriptors::module::ModuleId, |
11 | syntax_ptr::LocalSyntaxPtr, | 12 | syntax_ptr::LocalSyntaxPtr, |
12 | }; | 13 | }; |
@@ -45,7 +46,8 @@ struct ItemMap { | |||
45 | 46 | ||
46 | #[derive(Debug)] | 47 | #[derive(Debug)] |
47 | struct ModuleItems { | 48 | struct ModuleItems { |
48 | items: FxHashMap<SmolStr, PerNs<ModuleItem>>, | 49 | items: FxHashMap<SmolStr, PerNs<DefId>>, |
50 | import_resolutions: FxHashMap<LocalSyntaxPtr, DefId>, | ||
49 | } | 51 | } |
50 | 52 | ||
51 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | 53 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
@@ -197,3 +199,14 @@ impl ModuleItem { | |||
197 | Some(res) | 199 | Some(res) |
198 | } | 200 | } |
199 | } | 201 | } |
202 | |||
203 | struct Resolver { | ||
204 | input: FxHashMap<ModuleId, InputModuleItems>, | ||
205 | result: ModuleItems, | ||
206 | } | ||
207 | |||
208 | impl Resolver { | ||
209 | fn resolve(&mut self){ | ||
210 | |||
211 | } | ||
212 | } | ||
diff --git a/crates/ra_analysis/src/loc2id.rs b/crates/ra_analysis/src/loc2id.rs index 8c297156a..87417df94 100644 --- a/crates/ra_analysis/src/loc2id.rs +++ b/crates/ra_analysis/src/loc2id.rs | |||
@@ -8,7 +8,9 @@ use std::{ | |||
8 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | descriptors::module::ModuleId, | ||
11 | syntax_ptr::SyntaxPtr, | 12 | syntax_ptr::SyntaxPtr, |
13 | input::SourceRootId, | ||
12 | }; | 14 | }; |
13 | 15 | ||
14 | /// There are two principle ways to refer to things: | 16 | /// There are two principle ways to refer to things: |
@@ -89,6 +91,21 @@ macro_rules! impl_numeric_id { | |||
89 | pub(crate) struct FnId(u32); | 91 | pub(crate) struct FnId(u32); |
90 | impl_numeric_id!(FnId); | 92 | impl_numeric_id!(FnId); |
91 | 93 | ||
94 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
95 | pub(crate) struct DefId(u32); | ||
96 | impl_numeric_id!(DefId); | ||
97 | |||
98 | #[derive(Clone, Debug, PartialEq, Eq, Hash)] | ||
99 | enum DefLoc { | ||
100 | Module { | ||
101 | id: ModuleId, | ||
102 | source_root: SourceRootId, | ||
103 | }, | ||
104 | Item { | ||
105 | ptr: SyntaxPtr, | ||
106 | } | ||
107 | } | ||
108 | |||
92 | pub(crate) trait IdDatabase: salsa::Database { | 109 | pub(crate) trait IdDatabase: salsa::Database { |
93 | fn id_maps(&self) -> &IdMaps; | 110 | fn id_maps(&self) -> &IdMaps; |
94 | } | 111 | } |
@@ -110,4 +127,5 @@ impl IdMaps { | |||
110 | #[derive(Debug, Default)] | 127 | #[derive(Debug, Default)] |
111 | struct IdMapsInner { | 128 | struct IdMapsInner { |
112 | fns: Mutex<Loc2IdMap<SyntaxPtr, FnId>>, | 129 | fns: Mutex<Loc2IdMap<SyntaxPtr, FnId>>, |
130 | defs: Mutex<Loc2IdMap<DefLoc, DefId>>, | ||
113 | } | 131 | } |