diff options
author | Seivan Heidari <[email protected]> | 2019-10-31 08:43:20 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-10-31 08:43:20 +0000 |
commit | 8edda0e7b164009d6c03bb3d4be603fb38ad2e2a (patch) | |
tree | 744cf81075d394e2f9c06afb07642a2601800dda /crates/ra_hir_def/src/db.rs | |
parent | 49562d36b97ddde34cf7585a8c2e8f232519b657 (diff) | |
parent | d067afb064a7fa67b172abf561b7d80740cd6f18 (diff) |
Merge branch 'master' into feature/themes
Diffstat (limited to 'crates/ra_hir_def/src/db.rs')
-rw-r--r-- | crates/ra_hir_def/src/db.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs new file mode 100644 index 000000000..b271636b0 --- /dev/null +++ b/crates/ra_hir_def/src/db.rs | |||
@@ -0,0 +1,40 @@ | |||
1 | //! Defines database & queries for name resolution. | ||
2 | use std::sync::Arc; | ||
3 | |||
4 | use hir_expand::{db::AstDatabase, HirFileId}; | ||
5 | use ra_db::{salsa, SourceDatabase}; | ||
6 | use ra_syntax::ast; | ||
7 | |||
8 | use crate::nameres::raw::{ImportSourceMap, RawItems}; | ||
9 | |||
10 | #[salsa::query_group(InternDatabaseStorage)] | ||
11 | pub trait InternDatabase: SourceDatabase { | ||
12 | #[salsa::interned] | ||
13 | fn intern_function(&self, loc: crate::ItemLoc<ast::FnDef>) -> crate::FunctionId; | ||
14 | #[salsa::interned] | ||
15 | fn intern_struct(&self, loc: crate::ItemLoc<ast::StructDef>) -> crate::StructId; | ||
16 | #[salsa::interned] | ||
17 | fn intern_union(&self, loc: crate::ItemLoc<ast::StructDef>) -> crate::UnionId; | ||
18 | #[salsa::interned] | ||
19 | fn intern_enum(&self, loc: crate::ItemLoc<ast::EnumDef>) -> crate::EnumId; | ||
20 | #[salsa::interned] | ||
21 | fn intern_const(&self, loc: crate::ItemLoc<ast::ConstDef>) -> crate::ConstId; | ||
22 | #[salsa::interned] | ||
23 | fn intern_static(&self, loc: crate::ItemLoc<ast::StaticDef>) -> crate::StaticId; | ||
24 | #[salsa::interned] | ||
25 | fn intern_trait(&self, loc: crate::ItemLoc<ast::TraitDef>) -> crate::TraitId; | ||
26 | #[salsa::interned] | ||
27 | fn intern_type_alias(&self, loc: crate::ItemLoc<ast::TypeAliasDef>) -> crate::TypeAliasId; | ||
28 | } | ||
29 | |||
30 | #[salsa::query_group(DefDatabase2Storage)] | ||
31 | pub trait DefDatabase2: InternDatabase + AstDatabase { | ||
32 | #[salsa::invoke(RawItems::raw_items_with_source_map_query)] | ||
33 | fn raw_items_with_source_map( | ||
34 | &self, | ||
35 | file_id: HirFileId, | ||
36 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>); | ||
37 | |||
38 | #[salsa::invoke(RawItems::raw_items_query)] | ||
39 | fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; | ||
40 | } | ||