aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2019-01-28 14:26:32 +0000
committerJeremy Kolb <[email protected]>2019-01-30 00:13:02 +0000
commit3c17643b3085682a695f0e6d80483edc00d04cb3 (patch)
tree2e76d7be4f703a46608078228124285bc2c94e21 /crates/ra_hir/src/code_model_impl
parent48d2acb297459fb06cbb49bdce2eccb4c2591714 (diff)
Go to Implementation for structs and enums
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs13
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 }