aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/hir/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/hir/db.rs')
-rw-r--r--crates/ra_analysis/src/hir/db.rs85
1 files changed, 44 insertions, 41 deletions
diff --git a/crates/ra_analysis/src/hir/db.rs b/crates/ra_analysis/src/hir/db.rs
index 498a5c2dd..c6dbde79b 100644
--- a/crates/ra_analysis/src/hir/db.rs
+++ b/crates/ra_analysis/src/hir/db.rs
@@ -8,56 +8,59 @@ use ra_syntax::{
8use crate::{ 8use crate::{
9 FileId, 9 FileId,
10 db::SyntaxDatabase, 10 db::SyntaxDatabase,
11 hir::query_definitions,
11 hir::function::{FnId, FnScopes}, 12 hir::function::{FnId, FnScopes},
12 hir::module::{ 13 hir::module::{
13 ModuleId, ModuleTree, ModuleSource, 14 ModuleId, ModuleTree, ModuleSource,
14 nameres::{ItemMap, InputModuleItems, FileItems, FileItemId} 15 nameres::{ItemMap, InputModuleItems, FileItems, FileItemId}
15 }, 16 },
16 input::SourceRootId, 17 input::SourceRootId,
17 loc2id::{IdDatabase},
18 Cancelable, 18 Cancelable,
19}; 19};
20 20
21salsa::query_group! { 21salsa::query_group! {
22pub(crate) trait HirDatabase: SyntaxDatabase + IdDatabase { 22
23 fn fn_scopes(fn_id: FnId) -> Arc<FnScopes> { 23pub(crate) trait HirDatabase: SyntaxDatabase {
24 type FnScopesQuery; 24 fn fn_scopes(fn_id: FnId) -> Arc<FnScopes> {
25 use fn crate::hir::function::imp::fn_scopes; 25 type FnScopesQuery;
26 } 26 use fn query_definitions::fn_scopes;
27 27 }
28 fn file_items(file_id: FileId) -> Arc<FileItems> { 28 fn fn_syntax(fn_id: FnId) -> FnDefNode {
29 type FileItemsQuery; 29 type FnSyntaxQuery;
30 storage dependencies; 30 // Don't retain syntax trees in memory
31 use fn crate::hir::module::nameres::file_items; 31 storage dependencies;
32 } 32 use fn query_definitions::fn_syntax;
33 33 }
34 fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { 34
35 type FileItemQuery; 35 fn file_items(file_id: FileId) -> Arc<FileItems> {
36 storage dependencies; 36 type FileItemsQuery;
37 use fn crate::hir::module::nameres::file_item; 37 storage dependencies;
38 } 38 use fn query_definitions::file_items;
39 39 }
40 fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> { 40
41 type InputModuleItemsQuery; 41 fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode {
42 use fn crate::hir::module::nameres::input_module_items; 42 type FileItemQuery;
43 } 43 storage dependencies;
44 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> { 44 use fn query_definitions::file_item;
45 type ItemMapQuery; 45 }
46 use fn crate::hir::module::nameres::item_map; 46
47 } 47 fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> {
48 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> { 48 type SubmodulesQuery;
49 type ModuleTreeQuery; 49 use fn query_definitions::submodules;
50 use fn crate::hir::module::imp::module_tree; 50 }
51 } 51
52 fn fn_syntax(fn_id: FnId) -> FnDefNode { 52 fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
53 type FnSyntaxQuery; 53 type InputModuleItemsQuery;
54 // Don't retain syntax trees in memory 54 use fn query_definitions::input_module_items;
55 storage dependencies; 55 }
56 use fn crate::hir::function::imp::fn_syntax; 56 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
57 } 57 type ItemMapQuery;
58 fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> { 58 use fn query_definitions::item_map;
59 type SubmodulesQuery;
60 use fn crate::hir::module::imp::submodules;
61 }
62 } 59 }
60 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
61 type ModuleTreeQuery;
62 use fn crate::hir::module::imp::module_tree;
63 }
64}
65
63} 66}