diff options
author | Jonas Schievink <[email protected]> | 2020-06-25 15:42:59 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-06-25 15:42:59 +0100 |
commit | b06214d16408e0b699f9d6051ba244e5fe766578 (patch) | |
tree | 0bf8eb18ca876b4b31395c486d20ed6320df836b /crates/ra_hir_def/src/item_tree | |
parent | 2a8fc9e6829c15a54e9094b940312e9485c6b79a (diff) |
Generalize FieldIds -> IdRange<T>
Diffstat (limited to 'crates/ra_hir_def/src/item_tree')
-rw-r--r-- | crates/ra_hir_def/src/item_tree/lower.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 230e1f768..93e8cc0c8 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -196,7 +196,7 @@ impl Ctx { | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> FieldIds { | 199 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange<Field> { |
200 | let start = self.next_field_idx(); | 200 | let start = self.next_field_idx(); |
201 | for field in fields.fields() { | 201 | for field in fields.fields() { |
202 | if let Some(data) = self.lower_record_field(&field) { | 202 | if let Some(data) = self.lower_record_field(&field) { |
@@ -205,7 +205,7 @@ impl Ctx { | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | let end = self.next_field_idx(); | 207 | let end = self.next_field_idx(); |
208 | FieldIds::new(start..end) | 208 | IdRange::new(start..end) |
209 | } | 209 | } |
210 | 210 | ||
211 | fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> { | 211 | fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> { |
@@ -216,7 +216,7 @@ impl Ctx { | |||
216 | Some(res) | 216 | Some(res) |
217 | } | 217 | } |
218 | 218 | ||
219 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> FieldIds { | 219 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { |
220 | let start = self.next_field_idx(); | 220 | let start = self.next_field_idx(); |
221 | for (i, field) in fields.fields().enumerate() { | 221 | for (i, field) in fields.fields().enumerate() { |
222 | if let Some(data) = self.lower_tuple_field(i, &field) { | 222 | if let Some(data) = self.lower_tuple_field(i, &field) { |
@@ -225,7 +225,7 @@ impl Ctx { | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | let end = self.next_field_idx(); | 227 | let end = self.next_field_idx(); |
228 | FieldIds::new(start..end) | 228 | IdRange::new(start..end) |
229 | } | 229 | } |
230 | 230 | ||
231 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Option<Field> { | 231 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Option<Field> { |
@@ -244,7 +244,7 @@ impl Ctx { | |||
244 | Some(record_field_def_list) => { | 244 | Some(record_field_def_list) => { |
245 | self.lower_fields(&StructKind::Record(record_field_def_list)) | 245 | self.lower_fields(&StructKind::Record(record_field_def_list)) |
246 | } | 246 | } |
247 | None => Fields::Record(FieldIds::new(self.next_field_idx()..self.next_field_idx())), | 247 | None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), |
248 | }; | 248 | }; |
249 | let ast_id = self.source_ast_id_map.ast_id(union); | 249 | let ast_id = self.source_ast_id_map.ast_id(union); |
250 | let res = Union { name, visibility, generic_params, fields, ast_id }; | 250 | let res = Union { name, visibility, generic_params, fields, ast_id }; |