diff options
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r-- | crates/ra_analysis/src/module_map.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs deleted file mode 100644 index 3c800265a..000000000 --- a/crates/ra_analysis/src/module_map.rs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | use std::sync::Arc; | ||
2 | |||
3 | use crate::{ | ||
4 | db, | ||
5 | Cancelable, | ||
6 | db::SyntaxDatabase, | ||
7 | descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, | ||
8 | FileId, | ||
9 | }; | ||
10 | |||
11 | salsa::query_group! { | ||
12 | pub(crate) trait ModulesDatabase: SyntaxDatabase { | ||
13 | fn module_tree() -> Cancelable<Arc<ModuleTreeDescriptor>> { | ||
14 | type ModuleTreeQuery; | ||
15 | } | ||
16 | fn module_descriptor(file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> { | ||
17 | type ModuleDescriptorQuery; | ||
18 | } | ||
19 | } | ||
20 | } | ||
21 | |||
22 | fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> { | ||
23 | db::check_canceled(db)?; | ||
24 | let file = db.file_syntax(file_id); | ||
25 | Ok(Arc::new(ModuleDescriptor::new(file.ast()))) | ||
26 | } | ||
27 | |||
28 | fn module_tree(db: &impl ModulesDatabase) -> Cancelable<Arc<ModuleTreeDescriptor>> { | ||
29 | db::check_canceled(db)?; | ||
30 | let file_set = db.file_set(); | ||
31 | let mut files = Vec::new(); | ||
32 | for &file_id in file_set.files.iter() { | ||
33 | let module_descr = db.module_descriptor(file_id)?; | ||
34 | files.push((file_id, module_descr)); | ||
35 | } | ||
36 | let res = ModuleTreeDescriptor::new( | ||
37 | files.iter().map(|(file_id, descr)| (*file_id, &**descr)), | ||
38 | &file_set.resolver, | ||
39 | ); | ||
40 | Ok(Arc::new(res)) | ||
41 | } | ||