diff options
Diffstat (limited to 'crates/ra_hir/src/adt.rs')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 99d286215..3e9cd3c63 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -9,7 +9,7 @@ use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; | |||
9 | use crate::{ | 9 | use crate::{ |
10 | db::{AstDatabase, DefDatabase, HirDatabase}, | 10 | db::{AstDatabase, DefDatabase, HirDatabase}, |
11 | type_ref::TypeRef, | 11 | type_ref::TypeRef, |
12 | AsName, Enum, EnumVariant, FieldSource, HasSource, Name, Source, Struct, StructField, | 12 | AsName, Enum, EnumVariant, FieldSource, HasSource, Module, Name, Source, Struct, StructField, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | impl Struct { | 15 | impl Struct { |
@@ -170,12 +170,20 @@ impl VariantDef { | |||
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | pub(crate) fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> { | 173 | pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> { |
174 | match self { | 174 | match self { |
175 | VariantDef::Struct(it) => it.field(db, name), | 175 | VariantDef::Struct(it) => it.field(db, name), |
176 | VariantDef::EnumVariant(it) => it.field(db, name), | 176 | VariantDef::EnumVariant(it) => it.field(db, name), |
177 | } | 177 | } |
178 | } | 178 | } |
179 | |||
180 | pub fn module(self, db: &impl HirDatabase) -> Module { | ||
181 | match self { | ||
182 | VariantDef::Struct(it) => it.module(db), | ||
183 | VariantDef::EnumVariant(it) => it.module(db), | ||
184 | } | ||
185 | } | ||
186 | |||
179 | pub(crate) fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> { | 187 | pub(crate) fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> { |
180 | match self { | 188 | match self { |
181 | VariantDef::Struct(it) => it.variant_data(db), | 189 | VariantDef::Struct(it) => it.variant_data(db), |