aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/impls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/impls.rs')
-rw-r--r--crates/ra_hir_def/src/impls.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/impls.rs b/crates/ra_hir_def/src/impls.rs
index 9be38c5e1..750a869f2 100644
--- a/crates/ra_hir_def/src/impls.rs
+++ b/crates/ra_hir_def/src/impls.rs
@@ -9,8 +9,8 @@ use hir_expand::AstId;
9use ra_syntax::ast; 9use ra_syntax::ast;
10 10
11use crate::{ 11use crate::{
12 db::DefDatabase2, type_ref::TypeRef, AssocItemId, AstItemDef, ConstId, FunctionContainerId, 12 db::DefDatabase2, type_ref::TypeRef, AssocItemId, AstItemDef, ConstLoc, ContainerId,
13 FunctionLoc, ImplId, Intern, LocationCtx, TypeAliasId, 13 FunctionLoc, ImplId, Intern, TypeAliasLoc,
14}; 14};
15 15
16#[derive(Debug, Clone, PartialEq, Eq)] 16#[derive(Debug, Clone, PartialEq, Eq)]
@@ -31,23 +31,32 @@ impl ImplData {
31 let negative = src.value.is_negative(); 31 let negative = src.value.is_negative();
32 32
33 let items = if let Some(item_list) = src.value.item_list() { 33 let items = if let Some(item_list) = src.value.item_list() {
34 let ctx = LocationCtx::new(db, id.module(db), src.file_id);
35 item_list 34 item_list
36 .impl_items() 35 .impl_items()
37 .map(|item_node| match item_node { 36 .map(|item_node| match item_node {
38 ast::ImplItem::FnDef(it) => { 37 ast::ImplItem::FnDef(it) => {
39 let func_id = FunctionLoc { 38 let def = FunctionLoc {
40 container: FunctionContainerId::ImplId(id), 39 container: ContainerId::ImplId(id),
41 ast_id: AstId::new(src.file_id, items.ast_id(&it)), 40 ast_id: AstId::new(src.file_id, items.ast_id(&it)),
42 } 41 }
43 .intern(db); 42 .intern(db);
44 func_id.into() 43 def.into()
45 } 44 }
46 ast::ImplItem::ConstDef(it) => { 45 ast::ImplItem::ConstDef(it) => {
47 ConstId::from_ast_id(ctx, items.ast_id(&it)).into() 46 let def = ConstLoc {
47 container: ContainerId::ImplId(id),
48 ast_id: AstId::new(src.file_id, items.ast_id(&it)),
49 }
50 .intern(db);
51 def.into()
48 } 52 }
49 ast::ImplItem::TypeAliasDef(it) => { 53 ast::ImplItem::TypeAliasDef(it) => {
50 TypeAliasId::from_ast_id(ctx, items.ast_id(&it)).into() 54 let def = TypeAliasLoc {
55 container: ContainerId::ImplId(id),
56 ast_id: AstId::new(src.file_id, items.ast_id(&it)),
57 }
58 .intern(db);
59 def.into()
51 } 60 }
52 }) 61 })
53 .collect() 62 .collect()