diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-20 15:45:22 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-20 15:45:22 +0000 |
commit | c51dcb1c4bdd71f9f17de508bd0d47e3c06ae1d5 (patch) | |
tree | 7e96d773620a3b03254d00386711cdc7c909e3ee /crates/ra_hir_def/src/impls.rs | |
parent | b7a36b54431ca5b746af53549a1b6e142570c7f4 (diff) | |
parent | 111891dc2dc1d2c7ea87144e8e3ddefe23fc7b6d (diff) |
Merge #2327
2327: Move constants to new ID r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/impls.rs')
-rw-r--r-- | crates/ra_hir_def/src/impls.rs | 25 |
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; | |||
9 | use ra_syntax::ast; | 9 | use ra_syntax::ast; |
10 | 10 | ||
11 | use crate::{ | 11 | use 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() |