diff options
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index d3908f8ac..3296b9b31 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; | 3 | use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; |
4 | use ra_db::{SourceDatabase, salsa, FileId}; | 4 | use ra_db::{SourceDatabase, salsa}; |
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | HirFileId, SourceFileItems, SourceItemId, Crate, Module, HirInterner, | 7 | HirFileId, MacroDefId, SourceFileItems, SourceItemId, Crate, Module, HirInterner, |
8 | Function, FnSignature, ExprScopes, TypeAlias, | 8 | Function, FnSignature, ExprScopes, TypeAlias, |
9 | Struct, Enum, StructField, | 9 | Struct, Enum, StructField, |
10 | Const, ConstSignature, Static, | 10 | Const, ConstSignature, Static, |
@@ -14,10 +14,14 @@ use crate::{ | |||
14 | impl_block::{ModuleImplBlocks, ImplSourceMap}, | 14 | impl_block::{ModuleImplBlocks, ImplSourceMap}, |
15 | generics::{GenericParams, GenericDef}, | 15 | generics::{GenericParams, GenericDef}, |
16 | type_ref::TypeRef, | 16 | type_ref::TypeRef, |
17 | traits::TraitData, Trait, ty::TraitRef | ||
17 | }; | 18 | }; |
18 | 19 | ||
19 | #[salsa::query_group(DefDatabaseStorage)] | 20 | #[salsa::query_group(DefDatabaseStorage)] |
20 | pub trait DefDatabase: SourceDatabase + AsRef<HirInterner> { | 21 | pub trait DefDatabase: SourceDatabase + AsRef<HirInterner> { |
22 | #[salsa::invoke(crate::ids::macro_def_query)] | ||
23 | fn macro_def(&self, macro_id: MacroDefId) -> Option<Arc<mbe::MacroRules>>; | ||
24 | |||
21 | #[salsa::invoke(HirFileId::hir_parse)] | 25 | #[salsa::invoke(HirFileId::hir_parse)] |
22 | fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>; | 26 | fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>; |
23 | 27 | ||
@@ -27,17 +31,23 @@ pub trait DefDatabase: SourceDatabase + AsRef<HirInterner> { | |||
27 | #[salsa::invoke(crate::adt::EnumData::enum_data_query)] | 31 | #[salsa::invoke(crate::adt::EnumData::enum_data_query)] |
28 | fn enum_data(&self, e: Enum) -> Arc<EnumData>; | 32 | fn enum_data(&self, e: Enum) -> Arc<EnumData>; |
29 | 33 | ||
30 | #[salsa::invoke(crate::ids::SourceFileItems::file_items_query)] | 34 | #[salsa::invoke(crate::traits::TraitData::trait_data_query)] |
35 | fn trait_data(&self, t: Trait) -> Arc<TraitData>; | ||
36 | |||
37 | #[salsa::invoke(crate::source_id::SourceFileItems::file_items_query)] | ||
31 | fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>; | 38 | fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>; |
32 | 39 | ||
33 | #[salsa::invoke(crate::ids::SourceFileItems::file_item_query)] | 40 | #[salsa::invoke(crate::source_id::SourceFileItems::file_item_query)] |
34 | fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>; | 41 | fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>; |
35 | 42 | ||
36 | #[salsa::invoke(RawItems::raw_items_query)] | 43 | #[salsa::invoke(RawItems::raw_items_query)] |
37 | fn raw_items(&self, file_id: FileId) -> Arc<RawItems>; | 44 | fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; |
38 | 45 | ||
39 | #[salsa::invoke(RawItems::raw_items_with_source_map_query)] | 46 | #[salsa::invoke(RawItems::raw_items_with_source_map_query)] |
40 | fn raw_items_with_source_map(&self, file_id: FileId) -> (Arc<RawItems>, Arc<ImportSourceMap>); | 47 | fn raw_items_with_source_map( |
48 | &self, | ||
49 | file_id: HirFileId, | ||
50 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>); | ||
41 | 51 | ||
42 | #[salsa::invoke(CrateDefMap::crate_def_map_query)] | 52 | #[salsa::invoke(CrateDefMap::crate_def_map_query)] |
43 | fn crate_def_map(&self, krate: Crate) -> Arc<CrateDefMap>; | 53 | fn crate_def_map(&self, krate: Crate) -> Arc<CrateDefMap>; |
@@ -98,6 +108,9 @@ pub trait HirDatabase: DefDatabase { | |||
98 | 108 | ||
99 | #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] | 109 | #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] |
100 | fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>; | 110 | fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>; |
111 | |||
112 | #[salsa::invoke(crate::ty::method_resolution::implements)] | ||
113 | fn implements(&self, trait_ref: TraitRef) -> bool; | ||
101 | } | 114 | } |
102 | 115 | ||
103 | #[test] | 116 | #[test] |