diff options
Diffstat (limited to 'crates/ra_hir/src/adt.rs')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 78ea8976b..e027eedd9 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -6,7 +6,7 @@ use std::sync::Arc; | |||
6 | use ra_arena::{RawId, Arena, impl_arena_id}; | 6 | use ra_arena::{RawId, Arena, impl_arena_id}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | TreeArc, | 8 | TreeArc, |
9 | ast::{self, NameOwner, StructFlavor, TypeAscriptionOwner} | 9 | ast::{self, NameOwner, StructKind, TypeAscriptionOwner} |
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
@@ -47,7 +47,7 @@ pub struct StructData { | |||
47 | impl StructData { | 47 | impl StructData { |
48 | fn new(struct_def: &ast::StructDef) -> StructData { | 48 | fn new(struct_def: &ast::StructDef) -> StructData { |
49 | let name = struct_def.name().map(|n| n.as_name()); | 49 | let name = struct_def.name().map(|n| n.as_name()); |
50 | let variant_data = VariantData::new(struct_def.flavor()); | 50 | let variant_data = VariantData::new(struct_def.kind()); |
51 | let variant_data = Arc::new(variant_data); | 51 | let variant_data = Arc::new(variant_data); |
52 | StructData { name, variant_data } | 52 | StructData { name, variant_data } |
53 | } | 53 | } |
@@ -94,7 +94,7 @@ impl EnumData { | |||
94 | let variants = variants(&*enum_def) | 94 | let variants = variants(&*enum_def) |
95 | .map(|var| EnumVariantData { | 95 | .map(|var| EnumVariantData { |
96 | name: var.name().map(|it| it.as_name()), | 96 | name: var.name().map(|it| it.as_name()), |
97 | variant_data: Arc::new(VariantData::new(var.flavor())), | 97 | variant_data: Arc::new(VariantData::new(var.kind())), |
98 | }) | 98 | }) |
99 | .collect(); | 99 | .collect(); |
100 | Arc::new(EnumData { name, variants }) | 100 | Arc::new(EnumData { name, variants }) |
@@ -143,9 +143,9 @@ impl VariantData { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | impl VariantData { | 145 | impl VariantData { |
146 | fn new(flavor: StructFlavor) -> Self { | 146 | fn new(flavor: StructKind) -> Self { |
147 | let inner = match flavor { | 147 | let inner = match flavor { |
148 | ast::StructFlavor::Tuple(fl) => { | 148 | ast::StructKind::Tuple(fl) => { |
149 | let fields = fl | 149 | let fields = fl |
150 | .fields() | 150 | .fields() |
151 | .enumerate() | 151 | .enumerate() |
@@ -156,7 +156,7 @@ impl VariantData { | |||
156 | .collect(); | 156 | .collect(); |
157 | VariantDataInner::Tuple(fields) | 157 | VariantDataInner::Tuple(fields) |
158 | } | 158 | } |
159 | ast::StructFlavor::Named(fl) => { | 159 | ast::StructKind::Named(fl) => { |
160 | let fields = fl | 160 | let fields = fl |
161 | .fields() | 161 | .fields() |
162 | .map(|fd| StructFieldData { | 162 | .map(|fd| StructFieldData { |
@@ -166,7 +166,7 @@ impl VariantData { | |||
166 | .collect(); | 166 | .collect(); |
167 | VariantDataInner::Struct(fields) | 167 | VariantDataInner::Struct(fields) |
168 | } | 168 | } |
169 | ast::StructFlavor::Unit => VariantDataInner::Unit, | 169 | ast::StructKind::Unit => VariantDataInner::Unit, |
170 | }; | 170 | }; |
171 | VariantData(inner) | 171 | VariantData(inner) |
172 | } | 172 | } |
@@ -200,27 +200,27 @@ impl StructField { | |||
200 | let fields = var_data.fields().unwrap(); | 200 | let fields = var_data.fields().unwrap(); |
201 | let ss; | 201 | let ss; |
202 | let es; | 202 | let es; |
203 | let (file_id, struct_flavor) = match self.parent { | 203 | let (file_id, struct_kind) = match self.parent { |
204 | VariantDef::Struct(s) => { | 204 | VariantDef::Struct(s) => { |
205 | let (file_id, source) = s.source(db); | 205 | let (file_id, source) = s.source(db); |
206 | ss = source; | 206 | ss = source; |
207 | (file_id, ss.flavor()) | 207 | (file_id, ss.kind()) |
208 | } | 208 | } |
209 | VariantDef::EnumVariant(e) => { | 209 | VariantDef::EnumVariant(e) => { |
210 | let (file_id, source) = e.source(db); | 210 | let (file_id, source) = e.source(db); |
211 | es = source; | 211 | es = source; |
212 | (file_id, es.flavor()) | 212 | (file_id, es.kind()) |
213 | } | 213 | } |
214 | }; | 214 | }; |
215 | 215 | ||
216 | let field_sources = match struct_flavor { | 216 | let field_sources = match struct_kind { |
217 | ast::StructFlavor::Tuple(fl) => { | 217 | ast::StructKind::Tuple(fl) => { |
218 | fl.fields().map(|it| FieldSource::Pos(it.to_owned())).collect() | 218 | fl.fields().map(|it| FieldSource::Pos(it.to_owned())).collect() |
219 | } | 219 | } |
220 | ast::StructFlavor::Named(fl) => { | 220 | ast::StructKind::Named(fl) => { |
221 | fl.fields().map(|it| FieldSource::Named(it.to_owned())).collect() | 221 | fl.fields().map(|it| FieldSource::Named(it.to_owned())).collect() |
222 | } | 222 | } |
223 | ast::StructFlavor::Unit => Vec::new(), | 223 | ast::StructKind::Unit => Vec::new(), |
224 | }; | 224 | }; |
225 | let field = field_sources | 225 | let field = field_sources |
226 | .into_iter() | 226 | .into_iter() |