aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/module_map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/module_map.rs')
-rw-r--r--crates/ra_analysis/src/module_map.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs
index 0c413becd..3c800265a 100644
--- a/crates/ra_analysis/src/module_map.rs
+++ b/crates/ra_analysis/src/module_map.rs
@@ -1,12 +1,13 @@
1use std::sync::Arc;
2
1use crate::{ 3use crate::{
4 db,
2 Cancelable, 5 Cancelable,
3 db::SyntaxDatabase, 6 db::SyntaxDatabase,
4 descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, 7 descriptors::{ModuleDescriptor, ModuleTreeDescriptor},
5 FileId, 8 FileId,
6}; 9};
7 10
8use std::sync::Arc;
9
10salsa::query_group! { 11salsa::query_group! {
11 pub(crate) trait ModulesDatabase: SyntaxDatabase { 12 pub(crate) trait ModulesDatabase: SyntaxDatabase {
12 fn module_tree() -> Cancelable<Arc<ModuleTreeDescriptor>> { 13 fn module_tree() -> Cancelable<Arc<ModuleTreeDescriptor>> {
@@ -19,11 +20,13 @@ salsa::query_group! {
19} 20}
20 21
21fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> { 22fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> {
23 db::check_canceled(db)?;
22 let file = db.file_syntax(file_id); 24 let file = db.file_syntax(file_id);
23 Ok(Arc::new(ModuleDescriptor::new(file.ast()))) 25 Ok(Arc::new(ModuleDescriptor::new(file.ast())))
24} 26}
25 27
26fn module_tree(db: &impl ModulesDatabase) -> Cancelable<Arc<ModuleTreeDescriptor>> { 28fn module_tree(db: &impl ModulesDatabase) -> Cancelable<Arc<ModuleTreeDescriptor>> {
29 db::check_canceled(db)?;
27 let file_set = db.file_set(); 30 let file_set = db.file_set();
28 let mut files = Vec::new(); 31 let mut files = Vec::new();
29 for &file_id in file_set.files.iter() { 32 for &file_id in file_set.files.iter() {