From 88b51acd0ed2f5dedbc3a40d856e708f9816678c Mon Sep 17 00:00:00 2001 From: lyken Date: Wed, 28 Aug 2024 12:00:52 +0800 Subject: [PATCH] LenKind -> ArrayLen --- nac3core/src/codegen/model/array.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nac3core/src/codegen/model/array.rs b/nac3core/src/codegen/model/array.rs index 70cd1292..a6933023 100644 --- a/nac3core/src/codegen/model/array.rs +++ b/nac3core/src/codegen/model/array.rs @@ -11,7 +11,7 @@ use crate::codegen::{CodeGenContext, CodeGenerator}; use super::*; /// Trait for Rust structs identifying length values for [`Array`]. -pub trait LenKind: fmt::Debug + Clone + Copy { +pub trait ArrayLen: fmt::Debug + Clone + Copy { fn get_length(&self) -> u32; } @@ -23,13 +23,13 @@ pub struct Len; #[derive(Debug, Clone, Copy)] pub struct AnyLen(pub u32); -impl LenKind for Len { +impl ArrayLen for Len { fn get_length(&self) -> u32 { N } } -impl LenKind for AnyLen { +impl ArrayLen for AnyLen { fn get_length(&self) -> u32 { self.0 } @@ -46,7 +46,7 @@ pub struct Array { pub item: Item, } -impl<'ctx, Len: LenKind, Item: ModelBase<'ctx>> ModelBase<'ctx> for Array { +impl<'ctx, Len: ArrayLen, Item: ModelBase<'ctx>> ModelBase<'ctx> for Array { fn get_type_impl(&self, size_t: IntType<'ctx>, ctx: &'ctx Context) -> BasicTypeEnum<'ctx> { let item = self.item.get_type_impl(size_t, ctx); item.array_type(self.len.get_length()).into() @@ -78,12 +78,12 @@ impl<'ctx, Len: LenKind, Item: ModelBase<'ctx>> ModelBase<'ctx> for Array> Model<'ctx> for Array { +impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Model<'ctx> for Array { type Type = ArrayType<'ctx>; type Value = ArrayValue<'ctx>; } -impl<'ctx, Len: LenKind, Item: Model<'ctx>> Instance<'ctx, Ptr>> { +impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Instance<'ctx, Ptr>> { /// Get the pointer to the `i`-th (0-based) array element. pub fn gep( &self,