aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/db.rs
diff options
context:
space:
mode:
authorSeivan Heidari <[email protected]>2019-10-31 08:43:20 +0000
committerSeivan Heidari <[email protected]>2019-10-31 08:43:20 +0000
commit8edda0e7b164009d6c03bb3d4be603fb38ad2e2a (patch)
tree744cf81075d394e2f9c06afb07642a2601800dda /crates/ra_hir_def/src/db.rs
parent49562d36b97ddde34cf7585a8c2e8f232519b657 (diff)
parentd067afb064a7fa67b172abf561b7d80740cd6f18 (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.rs40
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.
2use std::sync::Arc;
3
4use hir_expand::{db::AstDatabase, HirFileId};
5use ra_db::{salsa, SourceDatabase};
6use ra_syntax::ast;
7
8use crate::nameres::raw::{ImportSourceMap, RawItems};
9
10#[salsa::query_group(InternDatabaseStorage)]
11pub 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)]
31pub 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}