aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs7
-rw-r--r--crates/ra_hir/src/code_model_impl/krate.rs10
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs16
3 files changed, 22 insertions, 11 deletions
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs
index 422643996..5b0b31b1d 100644
--- a/crates/ra_hir/src/code_model_impl/function.rs
+++ b/crates/ra_hir/src/code_model_impl/function.rs
@@ -5,7 +5,7 @@ use ra_syntax::ast::{self, NameOwner};
5use crate::{ 5use crate::{
6 HirDatabase, Name, AsName, Function, FnSignature, 6 HirDatabase, Name, AsName, Function, FnSignature,
7 type_ref::{TypeRef, Mutability}, 7 type_ref::{TypeRef, Mutability},
8 expr::Body, 8 expr::Body, PersistentHirDatabase,
9 impl_block::ImplBlock, 9 impl_block::ImplBlock,
10}; 10};
11 11
@@ -22,7 +22,10 @@ impl Function {
22} 22}
23 23
24impl FnSignature { 24impl FnSignature {
25 pub(crate) fn fn_signature_query(db: &impl HirDatabase, func: Function) -> Arc<FnSignature> { 25 pub(crate) fn fn_signature_query(
26 db: &impl PersistentHirDatabase,
27 func: Function,
28 ) -> Arc<FnSignature> {
26 let (_, node) = func.source(db); 29 let (_, node) = func.source(db);
27 let name = node 30 let name = node
28 .name() 31 .name()
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs
index 86f29d959..1517434b8 100644
--- a/crates/ra_hir/src/code_model_impl/krate.rs
+++ b/crates/ra_hir/src/code_model_impl/krate.rs
@@ -1,10 +1,12 @@
1use crate::{ 1use crate::{
2 Crate, CrateDependency, AsName, Module, 2 Crate, CrateDependency, AsName, Module, PersistentHirDatabase,
3 db::HirDatabase,
4}; 3};
5 4
6impl Crate { 5impl Crate {
7 pub(crate) fn dependencies_impl(&self, db: &impl HirDatabase) -> Vec<CrateDependency> { 6 pub(crate) fn dependencies_impl(
7 &self,
8 db: &impl PersistentHirDatabase,
9 ) -> Vec<CrateDependency> {
8 let crate_graph = db.crate_graph(); 10 let crate_graph = db.crate_graph();
9 crate_graph 11 crate_graph
10 .dependencies(self.crate_id) 12 .dependencies(self.crate_id)
@@ -17,7 +19,7 @@ impl Crate {
17 }) 19 })
18 .collect() 20 .collect()
19 } 21 }
20 pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option<Module> { 22 pub(crate) fn root_module_impl(&self, db: &impl PersistentHirDatabase) -> Option<Module> {
21 let module_tree = db.module_tree(*self); 23 let module_tree = db.module_tree(*self);
22 let module_id = module_tree.modules().next()?; 24 let module_id = module_tree.modules().next()?;
23 25
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 4a3901b8b..f487b8532 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -7,7 +7,7 @@ use crate::{
7 module_tree::ModuleId, 7 module_tree::ModuleId,
8 impl_block::ImplId, 8 impl_block::ImplId,
9 nameres::{lower::ImportId}, 9 nameres::{lower::ImportId},
10 db::HirDatabase, 10 HirDatabase, PersistentHirDatabase,
11}; 11};
12 12
13impl Module { 13impl Module {
@@ -24,7 +24,10 @@ impl Module {
24 Some(link.name(&module_tree).clone()) 24 Some(link.name(&module_tree).clone())
25 } 25 }
26 26
27 pub(crate) fn definition_source_impl(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) { 27 pub(crate) fn definition_source_impl(
28 &self,
29 db: &impl PersistentHirDatabase,
30 ) -> (FileId, ModuleSource) {
28 let module_tree = db.module_tree(self.krate); 31 let module_tree = db.module_tree(self.krate);
29 let file_id = self.module_id.file_id(&module_tree); 32 let file_id = self.module_id.file_id(&module_tree);
30 let decl_id = self.module_id.decl_id(&module_tree); 33 let decl_id = self.module_id.decl_id(&module_tree);
@@ -67,7 +70,7 @@ impl Module {
67 source_map.get(&source, impl_id) 70 source_map.get(&source, impl_id)
68 } 71 }
69 72
70 pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Module { 73 pub(crate) fn crate_root_impl(&self, db: &impl PersistentHirDatabase) -> Module {
71 let module_tree = db.module_tree(self.krate); 74 let module_tree = db.module_tree(self.krate);
72 let module_id = self.module_id.crate_root(&module_tree); 75 let module_id = self.module_id.crate_root(&module_tree);
73 self.with_module_id(module_id) 76 self.with_module_id(module_id)
@@ -81,7 +84,10 @@ impl Module {
81 } 84 }
82 85
83 /// Iterates over all child modules. 86 /// Iterates over all child modules.
84 pub(crate) fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> { 87 pub(crate) fn children_impl(
88 &self,
89 db: &impl PersistentHirDatabase,
90 ) -> impl Iterator<Item = Module> {
85 let module_tree = db.module_tree(self.krate); 91 let module_tree = db.module_tree(self.krate);
86 let children = self 92 let children = self
87 .module_id 93 .module_id
@@ -91,7 +97,7 @@ impl Module {
91 children.into_iter() 97 children.into_iter()
92 } 98 }
93 99
94 pub(crate) fn parent_impl(&self, db: &impl HirDatabase) -> Option<Module> { 100 pub(crate) fn parent_impl(&self, db: &impl PersistentHirDatabase) -> Option<Module> {
95 let module_tree = db.module_tree(self.krate); 101 let module_tree = db.module_tree(self.krate);
96 let parent_id = self.module_id.parent(&module_tree)?; 102 let parent_id = self.module_id.parent(&module_tree)?;
97 Some(self.with_module_id(parent_id)) 103 Some(self.with_module_id(parent_id))