diff options
Diffstat (limited to 'crates/ra_hir_def/src/data.rs')
-rw-r--r-- | crates/ra_hir_def/src/data.rs | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index b73e0d0a7..ba47629db 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Contains basic data about various HIR declarations. | ||
2 | |||
1 | use std::sync::Arc; | 3 | use std::sync::Arc; |
2 | 4 | ||
3 | use hir_expand::{ | 5 | use hir_expand::{ |
@@ -135,10 +137,10 @@ impl TraitData { | |||
135 | 137 | ||
136 | #[derive(Debug, Clone, PartialEq, Eq)] | 138 | #[derive(Debug, Clone, PartialEq, Eq)] |
137 | pub struct ImplData { | 139 | pub struct ImplData { |
138 | target_trait: Option<TypeRef>, | 140 | pub target_trait: Option<TypeRef>, |
139 | target_type: TypeRef, | 141 | pub target_type: TypeRef, |
140 | items: Vec<AssocItemId>, | 142 | pub items: Vec<AssocItemId>, |
141 | negative: bool, | 143 | pub is_negative: bool, |
142 | } | 144 | } |
143 | 145 | ||
144 | impl ImplData { | 146 | impl ImplData { |
@@ -148,7 +150,7 @@ impl ImplData { | |||
148 | 150 | ||
149 | let target_trait = src.value.target_trait().map(TypeRef::from_ast); | 151 | let target_trait = src.value.target_trait().map(TypeRef::from_ast); |
150 | let target_type = TypeRef::from_ast_opt(src.value.target_type()); | 152 | let target_type = TypeRef::from_ast_opt(src.value.target_type()); |
151 | let negative = src.value.is_negative(); | 153 | let is_negative = src.value.is_negative(); |
152 | 154 | ||
153 | let items = if let Some(item_list) = src.value.item_list() { | 155 | let items = if let Some(item_list) = src.value.item_list() { |
154 | item_list | 156 | item_list |
@@ -184,23 +186,7 @@ impl ImplData { | |||
184 | Vec::new() | 186 | Vec::new() |
185 | }; | 187 | }; |
186 | 188 | ||
187 | let res = ImplData { target_trait, target_type, items, negative }; | 189 | let res = ImplData { target_trait, target_type, items, is_negative }; |
188 | Arc::new(res) | 190 | Arc::new(res) |
189 | } | 191 | } |
190 | |||
191 | pub fn target_trait(&self) -> Option<&TypeRef> { | ||
192 | self.target_trait.as_ref() | ||
193 | } | ||
194 | |||
195 | pub fn target_type(&self) -> &TypeRef { | ||
196 | &self.target_type | ||
197 | } | ||
198 | |||
199 | pub fn items(&self) -> &[AssocItemId] { | ||
200 | &self.items | ||
201 | } | ||
202 | |||
203 | pub fn is_negative(&self) -> bool { | ||
204 | self.negative | ||
205 | } | ||
206 | } | 192 | } |