diff options
author | Aleksey Kladov <[email protected]> | 2019-12-12 14:11:57 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-12 14:11:57 +0000 |
commit | 56710f119b7114efac237ac36ea21730b8bd5311 (patch) | |
tree | 9e54318d6f291e3d997a9fe99554c24eeb4a47bc /crates/ra_hir_def/src/src.rs | |
parent | f135a8ea55c0a46c67713fb3b79b5f62ada430c1 (diff) |
Move enum&union to new loc
Diffstat (limited to 'crates/ra_hir_def/src/src.rs')
-rw-r--r-- | crates/ra_hir_def/src/src.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs index 7e212adb1..20200d1db 100644 --- a/crates/ra_hir_def/src/src.rs +++ b/crates/ra_hir_def/src/src.rs | |||
@@ -5,7 +5,8 @@ use ra_arena::map::ArenaMap; | |||
5 | use ra_syntax::ast; | 5 | use ra_syntax::ast; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | db::DefDatabase, ConstLoc, FunctionLoc, ImplLoc, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, | 8 | db::DefDatabase, ConstLoc, EnumLoc, FunctionLoc, ImplLoc, StaticLoc, StructLoc, TraitLoc, |
9 | TypeAliasLoc, UnionLoc, | ||
9 | }; | 10 | }; |
10 | 11 | ||
11 | pub trait HasSource { | 12 | pub trait HasSource { |
@@ -76,6 +77,24 @@ impl HasSource for StructLoc { | |||
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
80 | impl HasSource for UnionLoc { | ||
81 | type Value = ast::UnionDef; | ||
82 | |||
83 | fn source(&self, db: &impl DefDatabase) -> InFile<ast::UnionDef> { | ||
84 | let node = self.ast_id.to_node(db); | ||
85 | InFile::new(self.ast_id.file_id, node) | ||
86 | } | ||
87 | } | ||
88 | |||
89 | impl HasSource for EnumLoc { | ||
90 | type Value = ast::EnumDef; | ||
91 | |||
92 | fn source(&self, db: &impl DefDatabase) -> InFile<ast::EnumDef> { | ||
93 | let node = self.ast_id.to_node(db); | ||
94 | InFile::new(self.ast_id.file_id, node) | ||
95 | } | ||
96 | } | ||
97 | |||
79 | pub trait HasChildSource { | 98 | pub trait HasChildSource { |
80 | type ChildId; | 99 | type ChildId; |
81 | type Value; | 100 | type Value; |