ast/hir: Rename field-related structures

StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
This commit is contained in:
Vadim Petrochenkov 2021-03-16 00:36:07 +03:00
parent 195ad4830e
commit b25d3ba781
57 changed files with 313 additions and 301 deletions

View file

@ -301,7 +301,7 @@ impl<'tcx> DumpVisitor<'tcx> {
fn process_struct_field_def(
&mut self,
field: &'tcx hir::StructField<'tcx>,
field: &'tcx hir::FieldDef<'tcx>,
parent_id: hir::HirId,
) {
let field_data = self.save_ctxt.get_field_data(field, parent_id);
@ -793,7 +793,7 @@ impl<'tcx> DumpVisitor<'tcx> {
&mut self,
ex: &'tcx hir::Expr<'tcx>,
path: &'tcx hir::QPath<'tcx>,
fields: &'tcx [hir::Field<'tcx>],
fields: &'tcx [hir::ExprField<'tcx>],
variant: &'tcx ty::VariantDef,
rest: Option<&'tcx hir::Expr<'tcx>>,
) {

View file

@ -379,7 +379,7 @@ impl<'tcx> SaveContext<'tcx> {
}
}
pub fn get_field_data(&self, field: &hir::StructField<'_>, scope: hir::HirId) -> Option<Def> {
pub fn get_field_data(&self, field: &hir::FieldDef<'_>, scope: hir::HirId) -> Option<Def> {
let name = field.ident.to_string();
let scope_def_id = self.tcx.hir().local_def_id(scope).to_def_id();
let qualname = format!("::{}::{}", self.tcx.def_path_str(scope_def_id), field.ident);
@ -769,7 +769,7 @@ impl<'tcx> SaveContext<'tcx> {
pub fn get_field_ref_data(
&self,
field_ref: &hir::Field<'_>,
field_ref: &hir::ExprField<'_>,
variant: &ty::VariantDef,
) -> Option<Ref> {
filter!(self.span_utils, field_ref.ident.span);

View file

@ -55,7 +55,7 @@ pub fn foreign_item_signature(
/// Signature for a struct or tuple field declaration.
/// Does not include a trailing comma.
pub fn field_signature(field: &hir::StructField<'_>, scx: &SaveContext<'_>) -> Option<Signature> {
pub fn field_signature(field: &hir::FieldDef<'_>, scx: &SaveContext<'_>) -> Option<Signature> {
if !scx.config.signatures {
return None;
}
@ -655,7 +655,7 @@ impl<'hir> Sig for hir::Generics<'hir> {
}
}
impl<'hir> Sig for hir::StructField<'hir> {
impl<'hir> Sig for hir::FieldDef<'hir> {
fn make(&self, offset: usize, _parent_id: Option<hir::HirId>, scx: &SaveContext<'_>) -> Result {
let mut text = String::new();