aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/db.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-11-28 01:10:58 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-11-28 01:10:58 +0000
commit95c0c8f3986c8b3bcf0052d34d3ace09ebb9fa1b (patch)
tree0e5aa7337c000dd8c6ef3a7fedba68abf7feca8a /crates/ra_hir/src/db.rs
parent9f08341aa486ea59cb488635f19e960523568fb8 (diff)
parent59e29aef633e906837f8fed604435976a46be691 (diff)
Merge #247
247: Hir r=matklad a=matklad This doesn't achive anything new, just a big refactoring. The main change is that Descriptors are now called `hir`, and live in a separate crate. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r--crates/ra_hir/src/db.rs66
1 files changed, 66 insertions, 0 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
new file mode 100644
index 000000000..2f01bae6d
--- /dev/null
+++ b/crates/ra_hir/src/db.rs
@@ -0,0 +1,66 @@
1use std::sync::Arc;
2
3use ra_syntax::{
4 SyntaxNode,
5 ast::FnDefNode,
6};
7use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, FileId, Cancelable};
8
9use crate::{
10 DefLoc, DefId, FnId,
11 SourceFileItems, SourceItemId,
12 query_definitions,
13 FnScopes,
14 module::{ModuleId, ModuleTree, ModuleSource,
15 nameres::{ItemMap, InputModuleItems}},
16};
17
18salsa::query_group! {
19
20pub trait HirDatabase: SyntaxDatabase
21 + AsRef<LocationIntener<DefLoc, DefId>>
22 + AsRef<LocationIntener<SourceItemId, FnId>>
23{
24 fn fn_scopes(fn_id: FnId) -> Arc<FnScopes> {
25 type FnScopesQuery;
26 use fn query_definitions::fn_scopes;
27 }
28 fn fn_syntax(fn_id: FnId) -> FnDefNode {
29 type FnSyntaxQuery;
30 // Don't retain syntax trees in memory
31 storage dependencies;
32 use fn query_definitions::fn_syntax;
33 }
34
35 fn file_items(file_id: FileId) -> Arc<SourceFileItems> {
36 type SourceFileItemsQuery;
37 storage dependencies;
38 use fn query_definitions::file_items;
39 }
40
41 fn file_item(source_item_id: SourceItemId) -> SyntaxNode {
42 type FileItemQuery;
43 storage dependencies;
44 use fn query_definitions::file_item;
45 }
46
47 fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::module::imp::Submodule>>> {
48 type SubmodulesQuery;
49 use fn query_definitions::submodules;
50 }
51
52 fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
53 type InputModuleItemsQuery;
54 use fn query_definitions::input_module_items;
55 }
56 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
57 type ItemMapQuery;
58 use fn query_definitions::item_map;
59 }
60 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
61 type ModuleTreeQuery;
62 use fn crate::module::imp::module_tree;
63 }
64}
65
66}