diff options
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/module.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 418d59c91..c6f85ac82 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -5,6 +5,7 @@ use crate::{ | |||
5 | Module, ModuleSource, Problem, | 5 | Module, ModuleSource, Problem, |
6 | Crate, Name, | 6 | Crate, Name, |
7 | module_tree::ModuleId, | 7 | module_tree::ModuleId, |
8 | impl_block::ImplId, | ||
8 | nameres::{lower::ImportId}, | 9 | nameres::{lower::ImportId}, |
9 | db::HirDatabase, | 10 | db::HirDatabase, |
10 | }; | 11 | }; |
@@ -51,11 +52,21 @@ impl Module { | |||
51 | db: &impl HirDatabase, | 52 | db: &impl HirDatabase, |
52 | import: ImportId, | 53 | import: ImportId, |
53 | ) -> TreeArc<ast::PathSegment> { | 54 | ) -> TreeArc<ast::PathSegment> { |
54 | let source_map = db.lower_module_source_map(self.clone()); | 55 | let source_map = db.lower_module_source_map(*self); |
55 | let (_, source) = self.definition_source(db); | 56 | let (_, source) = self.definition_source(db); |
56 | source_map.get(&source, import) | 57 | source_map.get(&source, import) |
57 | } | 58 | } |
58 | 59 | ||
60 | pub(crate) fn impl_source_impl( | ||
61 | &self, | ||
62 | db: &impl HirDatabase, | ||
63 | impl_id: ImplId, | ||
64 | ) -> TreeArc<ast::ImplBlock> { | ||
65 | let source_map = db.impls_in_module_source_map(*self); | ||
66 | let (_, source) = self.definition_source(db); | ||
67 | source_map.get(&source, impl_id) | ||
68 | } | ||
69 | |||
59 | pub(crate) fn krate_impl(&self, _db: &impl HirDatabase) -> Option<Crate> { | 70 | pub(crate) fn krate_impl(&self, _db: &impl HirDatabase) -> Option<Crate> { |
60 | Some(Crate::new(self.krate)) | 71 | Some(Crate::new(self.krate)) |
61 | } | 72 | } |