diff options
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 5a8ca3b47..73a4cdc5c 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -1,13 +1,14 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_syntax::SyntaxNode; | 3 | use ra_syntax::{SyntaxNode, SourceFileNode}; |
4 | use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, FileId, Cancelable}; | 4 | use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable}; |
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | DefLoc, DefId, Name, | 7 | DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, |
8 | SourceFileItems, SourceItemId, | 8 | SourceFileItems, SourceItemId, |
9 | query_definitions, | 9 | query_definitions, |
10 | FnScopes, | 10 | FnScopes, |
11 | macros::MacroExpansion, | ||
11 | module::{ModuleId, ModuleTree, ModuleSource, | 12 | module::{ModuleId, ModuleTree, ModuleSource, |
12 | nameres::{ItemMap, InputModuleItems}}, | 13 | nameres::{ItemMap, InputModuleItems}}, |
13 | ty::{InferenceResult, Ty}, | 14 | ty::{InferenceResult, Ty}, |
@@ -18,7 +19,17 @@ salsa::query_group! { | |||
18 | 19 | ||
19 | pub trait HirDatabase: SyntaxDatabase | 20 | pub trait HirDatabase: SyntaxDatabase |
20 | + AsRef<LocationIntener<DefLoc, DefId>> | 21 | + AsRef<LocationIntener<DefLoc, DefId>> |
22 | + AsRef<LocationIntener<MacroCallLoc, MacroCallId>> | ||
21 | { | 23 | { |
24 | fn hir_source_file(file_id: HirFileId) -> SourceFileNode { | ||
25 | type HirSourceFileQuery; | ||
26 | use fn HirFileId::hir_source_file; | ||
27 | } | ||
28 | fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> { | ||
29 | type ExpandMacroCallQuery; | ||
30 | use fn crate::macros::expand_macro_invocation; | ||
31 | } | ||
32 | |||
22 | fn fn_scopes(def_id: DefId) -> Arc<FnScopes> { | 33 | fn fn_scopes(def_id: DefId) -> Arc<FnScopes> { |
23 | type FnScopesQuery; | 34 | type FnScopesQuery; |
24 | use fn query_definitions::fn_scopes; | 35 | use fn query_definitions::fn_scopes; |
@@ -49,7 +60,7 @@ pub trait HirDatabase: SyntaxDatabase | |||
49 | use fn crate::ty::type_for_field; | 60 | use fn crate::ty::type_for_field; |
50 | } | 61 | } |
51 | 62 | ||
52 | fn file_items(file_id: FileId) -> Arc<SourceFileItems> { | 63 | fn file_items(file_id: HirFileId) -> Arc<SourceFileItems> { |
53 | type SourceFileItemsQuery; | 64 | type SourceFileItemsQuery; |
54 | use fn query_definitions::file_items; | 65 | use fn query_definitions::file_items; |
55 | } | 66 | } |