aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/db.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-17 09:59:04 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-17 09:59:04 +0000
commit7d3f48cdaf20d718e711f999573adf3303e9396a (patch)
treedf584fbb044cad23e196da5ae0b3636b06bfeeff /crates/ra_hir/src/db.rs
parent65e763fa84ae70ec9cee13f434acaae5371ad8e5 (diff)
parent3a770233652cbf3e48688dd5f1d9f3c363eda5a8 (diff)
Merge #968
968: Macro aware name resoltion r=matklad a=matklad The first commit lays the ground work for new name resolution, including * extracting position-indendent items from parse trees * walking the tree of modules * old-style macro_rules resolve cc @pnkfelix: this looks like an API name resolution should interact with. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r--crates/ra_hir/src/db.rs39
1 files changed, 9 insertions, 30 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 5ad9547f1..c7bad7e2b 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,23 +1,18 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; 3use ra_syntax::{SyntaxNode, TreeArc, SourceFile};
4use ra_db::{SourceDatabase, salsa}; 4use ra_db::{SourceDatabase, salsa, FileId};
5 5
6use crate::{ 6use crate::{
7 MacroCallId, HirFileId, 7 HirFileId, SourceFileItems, SourceItemId, Crate, Module, HirInterner,
8 SourceFileItems, SourceItemId, Crate, Module, HirInterner,
9 Function, FnSignature, ExprScopes, TypeAlias, 8 Function, FnSignature, ExprScopes, TypeAlias,
10 Struct, Enum, StructField, 9 Struct, Enum, StructField,
11 Const, ConstSignature, Static, 10 Const, ConstSignature, Static,
12 macros::MacroExpansion, 11 nameres::{Namespace, ImportSourceMap, RawItems, CrateDefMap},
13 module_tree::ModuleTree,
14 nameres::{ItemMap, lower::{LoweredModule, ImportSourceMap}},
15 ty::{InferenceResult, Ty, method_resolution::CrateImplBlocks, TypableDef, CallableDef, FnSig}, 12 ty::{InferenceResult, Ty, method_resolution::CrateImplBlocks, TypableDef, CallableDef, FnSig},
16 adt::{StructData, EnumData}, 13 adt::{StructData, EnumData},
17 impl_block::{ModuleImplBlocks, ImplSourceMap}, 14 impl_block::{ModuleImplBlocks, ImplSourceMap},
18 generics::{GenericParams, GenericDef}, 15 generics::{GenericParams, GenericDef},
19 ids::SourceFileItemId,
20 nameres::Namespace,
21 type_ref::TypeRef, 16 type_ref::TypeRef,
22}; 17};
23 18
@@ -26,9 +21,6 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
26 #[salsa::invoke(HirFileId::hir_parse)] 21 #[salsa::invoke(HirFileId::hir_parse)]
27 fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>; 22 fn hir_parse(&self, file_id: HirFileId) -> TreeArc<SourceFile>;
28 23
29 #[salsa::invoke(crate::macros::expand_macro_invocation)]
30 fn expand_macro_invocation(&self, invoc: MacroCallId) -> Option<Arc<MacroExpansion>>;
31
32 #[salsa::invoke(crate::adt::StructData::struct_data_query)] 24 #[salsa::invoke(crate::adt::StructData::struct_data_query)]
33 fn struct_data(&self, s: Struct) -> Arc<StructData>; 25 fn struct_data(&self, s: Struct) -> Arc<StructData>;
34 26
@@ -41,27 +33,14 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
41 #[salsa::invoke(crate::ids::SourceFileItems::file_item_query)] 33 #[salsa::invoke(crate::ids::SourceFileItems::file_item_query)]
42 fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>; 34 fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
43 35
44 #[salsa::invoke(crate::module_tree::Submodule::submodules_query)] 36 #[salsa::invoke(RawItems::raw_items_query)]
45 fn submodules( 37 fn raw_items(&self, file_id: FileId) -> Arc<RawItems>;
46 &self,
47 file_id: HirFileId,
48 delc_id: Option<SourceFileItemId>,
49 ) -> Arc<Vec<crate::module_tree::Submodule>>;
50
51 #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_with_source_map_query)]
52 fn lower_module_with_source_map(
53 &self,
54 module: Module,
55 ) -> (Arc<LoweredModule>, Arc<ImportSourceMap>);
56
57 #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_query)]
58 fn lower_module(&self, module: Module) -> Arc<LoweredModule>;
59 38
60 #[salsa::invoke(crate::nameres::ItemMap::item_map_query)] 39 #[salsa::invoke(RawItems::raw_items_with_source_map_query)]
61 fn item_map(&self, krate: Crate) -> Arc<ItemMap>; 40 fn raw_items_with_source_map(&self, file_id: FileId) -> (Arc<RawItems>, Arc<ImportSourceMap>);
62 41
63 #[salsa::invoke(crate::module_tree::ModuleTree::module_tree_query)] 42 #[salsa::invoke(CrateDefMap::crate_def_map_query)]
64 fn module_tree(&self, krate: Crate) -> Arc<ModuleTree>; 43 fn crate_def_map(&self, krate: Crate) -> Arc<CrateDefMap>;
65 44
66 #[salsa::invoke(crate::impl_block::impls_in_module)] 45 #[salsa::invoke(crate::impl_block::impls_in_module)]
67 fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>; 46 fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>;