aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorcsmoe <[email protected]>2019-01-31 14:28:31 +0000
committercsmoe <[email protected]>2019-02-01 13:36:51 +0000
commit12433a78871610edfccc82442846615872747e06 (patch)
treef891a768fe4f92e002166b6fac891d7dedf320b7 /crates/ra_hir
parent21c593593163c22b996f7c8bffe05b9708f5b2d0 (diff)
split hirdatabase
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/db.rs46
1 files changed, 26 insertions, 20 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 189649841..7183b1630 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -19,8 +19,8 @@ use crate::{
19 ids::SourceFileItemId, 19 ids::SourceFileItemId,
20}; 20};
21 21
22#[salsa::query_group(HirDatabaseStorage)] 22#[salsa::query_group(PersistentHirDatabaseStorage)]
23pub trait HirDatabase: SourceDatabase + AsRef<HirInterner> { 23pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
24 #[salsa::invoke(HirFileId::hir_parse)] 24 #[salsa::invoke(HirFileId::hir_parse)]
25 fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>; 25 fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>;
26 26
@@ -36,21 +36,9 @@ pub trait HirDatabase: SourceDatabase + AsRef<HirInterner> {
36 #[salsa::invoke(crate::adt::EnumData::enum_data_query)] 36 #[salsa::invoke(crate::adt::EnumData::enum_data_query)]
37 fn enum_data(&self, e: Enum) -> Arc<EnumData>; 37 fn enum_data(&self, e: Enum) -> Arc<EnumData>;
38 38
39 #[salsa::invoke(crate::ty::infer)]
40 fn infer(&self, func: Function) -> Arc<InferenceResult>;
41
42 #[salsa::invoke(crate::ty::type_for_def)]
43 fn type_for_def(&self, def: TypableDef) -> Ty;
44
45 #[salsa::invoke(crate::ty::type_for_field)]
46 fn type_for_field(&self, field: StructField) -> Ty;
47
48 #[salsa::invoke(query_definitions::file_items)] 39 #[salsa::invoke(query_definitions::file_items)]
49 fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>; 40 fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>;
50 41
51 #[salsa::invoke(query_definitions::file_item)]
52 fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
53
54 #[salsa::invoke(crate::module_tree::Submodule::submodules_query)] 42 #[salsa::invoke(crate::module_tree::Submodule::submodules_query)]
55 fn submodules( 43 fn submodules(
56 &self, 44 &self,
@@ -88,15 +76,33 @@ pub trait HirDatabase: SourceDatabase + AsRef<HirInterner> {
88 #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] 76 #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)]
89 fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>; 77 fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>;
90 78
91 #[salsa::invoke(crate::expr::body_hir)]
92 fn body_hir(&self, func: Function) -> Arc<crate::expr::Body>;
93
94 #[salsa::invoke(crate::expr::body_syntax_mapping)]
95 fn body_syntax_mapping(&self, func: Function) -> Arc<crate::expr::BodySyntaxMapping>;
96
97 #[salsa::invoke(crate::generics::GenericParams::generic_params_query)] 79 #[salsa::invoke(crate::generics::GenericParams::generic_params_query)]
98 fn generic_params(&self, def: GenericDef) -> Arc<GenericParams>; 80 fn generic_params(&self, def: GenericDef) -> Arc<GenericParams>;
99 81
100 #[salsa::invoke(crate::FnSignature::fn_signature_query)] 82 #[salsa::invoke(crate::FnSignature::fn_signature_query)]
101 fn fn_signature(&self, func: Function) -> Arc<FnSignature>; 83 fn fn_signature(&self, func: Function) -> Arc<FnSignature>;
102} 84}
85
86#[salsa::query_group(HirDatabaseStorage)]
87pub trait HirDatabase: PersistentHirDatabase {
88 #[salsa::invoke(query_definitions::fn_scopes)]
89 fn fn_scopes(&self, func: Function) -> Arc<FnScopes>;
90
91 #[salsa::invoke(query_definitions::file_item)]
92 fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
93
94 #[salsa::invoke(crate::ty::infer)]
95 fn infer(&self, func: Function) -> Arc<InferenceResult>;
96
97 #[salsa::invoke(crate::ty::type_for_def)]
98 fn type_for_def(&self, def: TypableDef) -> Ty;
99
100 #[salsa::invoke(crate::ty::type_for_field)]
101 fn type_for_field(&self, field: StructField) -> Ty;
102
103 #[salsa::invoke(crate::expr::body_hir)]
104 fn body_hir(&self, func: Function) -> Arc<crate::expr::Body>;
105
106 #[salsa::invoke(crate::expr::body_syntax_mapping)]
107 fn body_syntax_mapping(&self, func: Function) -> Arc<crate::expr::BodySyntaxMapping>;
108}