From 3c17643b3085682a695f0e6d80483edc00d04cb3 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Mon, 28 Jan 2019 09:26:32 -0500 Subject: Go to Implementation for structs and enums --- crates/ra_hir/src/code_model_impl/module.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/code_model_impl') 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::{ Module, ModuleSource, Problem, Crate, Name, module_tree::ModuleId, + impl_block::ImplId, nameres::{lower::ImportId}, db::HirDatabase, }; @@ -51,11 +52,21 @@ impl Module { db: &impl HirDatabase, import: ImportId, ) -> TreeArc { - let source_map = db.lower_module_source_map(self.clone()); + let source_map = db.lower_module_source_map(*self); let (_, source) = self.definition_source(db); source_map.get(&source, import) } + pub(crate) fn impl_source_impl( + &self, + db: &impl HirDatabase, + impl_id: ImplId, + ) -> TreeArc { + let source_map = db.impls_in_module_source_map(*self); + let (_, source) = self.definition_source(db); + source_map.get(&source, impl_id) + } + pub(crate) fn krate_impl(&self, _db: &impl HirDatabase) -> Option { Some(Crate::new(self.krate)) } -- cgit v1.2.3