From d1c7a8ee5082b60963793d7cb3962940b8d33a8b Mon Sep 17 00:00:00 2001 From: lyken Date: Tue, 27 Aug 2024 17:41:03 +0800 Subject: [PATCH] StructKind::{traverse -> iter}_fields --- nac3core/src/codegen/model/structure.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nac3core/src/codegen/model/structure.rs b/nac3core/src/codegen/model/structure.rs index 4b5ab2ae..da452756 100644 --- a/nac3core/src/codegen/model/structure.rs +++ b/nac3core/src/codegen/model/structure.rs @@ -193,13 +193,13 @@ pub trait StructKind<'ctx>: fmt::Debug + Clone + Copy { /// Traverse through all fields of this [`StructKind`]. /// /// Only used internally in this module for implementing other components. - fn traverse_fields>(&self, traversal: &mut F) -> Self::Fields; + fn iter_fields>(&self, traversal: &mut F) -> Self::Fields; /// Get a convenience structure to get a struct field's GEP index through its corresponding Rust field. /// /// Only used internally in this module for implementing other components. fn fields(&self) -> Self::Fields { - self.traverse_fields(&mut GepFieldTraversal { gep_index_counter: 0 }) + self.iter_fields(&mut GepFieldTraversal { gep_index_counter: 0 }) } /// Get the LLVM [`StructType`] of this [`StructKind`]. @@ -209,7 +209,7 @@ pub trait StructKind<'ctx>: fmt::Debug + Clone + Copy { ctx: &'ctx Context, ) -> StructType<'ctx> { let mut traversal = TypeFieldTraversal { generator, ctx, field_types: Vec::new() }; - self.traverse_fields(&mut traversal); + self.iter_fields(&mut traversal); ctx.struct_type(&traversal.field_types, false) } @@ -270,7 +270,7 @@ impl<'ctx, S: StructKind<'ctx>> Model<'ctx> for Struct { errors: Vec::new(), scrutinee: ty, }; - self.0.traverse_fields(&mut traversal); + self.0.iter_fields(&mut traversal); // Check the number of fields. let exp_num_fields = traversal.gep_index_counter;