From 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:49:13 +0200 Subject: Rename FieldDef -> Field --- crates/ra_hir_def/src/adt.rs | 6 +++--- crates/ra_hir_def/src/item_tree/lower.rs | 29 +++++++++++++++-------------- crates/ra_hir_def/src/keys.rs | 4 ++-- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 4994a2125..2be23c45d 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -179,7 +179,7 @@ impl VariantData { impl HasChildSource for VariantId { type ChildId = LocalFieldId; - type Value = Either; + type Value = Either; fn child_source(&self, db: &dyn DefDatabase) -> InFile> { let (src, module_id) = match self { @@ -194,7 +194,7 @@ impl HasChildSource for VariantId { } VariantId::UnionId(it) => ( it.lookup(db).source(db).map(|it| { - it.record_field_def_list() + it.record_field_list() .map(ast::StructKind::Record) .unwrap_or(ast::StructKind::Unit) }), @@ -218,7 +218,7 @@ pub enum StructKind { fn lower_struct( db: &dyn DefDatabase, expander: &mut CfgExpander, - trace: &mut Trace>, + trace: &mut Trace>, ast: &InFile, ) -> StructKind { let ctx = LowerCtx::new(db, ast.file_id); diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 19d165b5b..df909ee9e 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -1,10 +1,7 @@ //! AST -> `ItemTree` lowering code. -use super::*; -use crate::{ - attr::Attrs, - generics::{GenericParams, TypeParamData, TypeParamProvenance}, -}; +use std::{collections::hash_map::Entry, mem, sync::Arc}; + use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; use ra_arena::map::ArenaMap; use ra_syntax::{ @@ -12,7 +9,13 @@ use ra_syntax::{ SyntaxNode, }; use smallvec::SmallVec; -use std::{collections::hash_map::Entry, mem, sync::Arc}; + +use crate::{ + attr::Attrs, + generics::{GenericParams, TypeParamData, TypeParamProvenance}, +}; + +use super::*; fn id(index: Idx) -> FileItemTreeId { FileItemTreeId { index, _p: PhantomData } @@ -191,7 +194,7 @@ impl Ctx { } } - fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange { + fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange { let start = self.next_field_idx(); for field in fields.fields() { if let Some(data) = self.lower_record_field(&field) { @@ -203,7 +206,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option { + fn lower_record_field(&mut self, field: &ast::RecordField) -> Option { let name = field.name()?.as_name(); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.ascribed_type()); @@ -211,7 +214,7 @@ impl Ctx { Some(res) } - fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange { + fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange { let start = self.next_field_idx(); for (i, field) in fields.fields().enumerate() { let data = self.lower_tuple_field(i, &field); @@ -222,7 +225,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { + fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { let name = Name::new_tuple_field(idx); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.type_ref()); @@ -234,10 +237,8 @@ impl Ctx { let visibility = self.lower_visibility(union); let name = union.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Union, union); - let fields = match union.record_field_def_list() { - Some(record_field_def_list) => { - self.lower_fields(&StructKind::Record(record_field_def_list)) - } + let fields = match union.record_field_list() { + Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)), None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), }; let ast_id = self.source_ast_id_map.ast_id(union); diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index f627eab1f..9ca276235 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -25,8 +25,8 @@ pub const UNION: Key = Key::new(); pub const ENUM: Key = Key::new(); pub const ENUM_VARIANT: Key = Key::new(); -pub const TUPLE_FIELD: Key = Key::new(); -pub const RECORD_FIELD: Key = Key::new(); +pub const TUPLE_FIELD: Key = Key::new(); +pub const RECORD_FIELD: Key = Key::new(); pub const TYPE_PARAM: Key = Key::new(); pub const MACRO: Key = Key::new(); -- cgit v1.2.3