From aea52af1a6eb6139bc1ef0a22e9f7863043806f6 Mon Sep 17 00:00:00 2001 From: David Mak Date: Tue, 19 Mar 2024 15:51:39 +0800 Subject: [PATCH] core: DO NOT MERGE - Split array values into more traits --- nac3core/src/codegen/classes.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/nac3core/src/codegen/classes.rs b/nac3core/src/codegen/classes.rs index 7cf4e68..4dca1b2 100644 --- a/nac3core/src/codegen/classes.rs +++ b/nac3core/src/codegen/classes.rs @@ -188,13 +188,6 @@ impl<'ctx> From> for PointerValue<'ctx> { } impl<'ctx> ArrayLikeValue<'ctx> for ArrayAllocaValue<'ctx> { - fn cast_elem_to_type( - _: &mut CodeGenContext<'ctx, '_>, - value: BasicValueEnum<'ctx>, - ) -> BasicValueEnum<'ctx> { - value - } - fn size( &self, _: &mut CodeGenContext<'ctx, '_>, @@ -202,7 +195,9 @@ impl<'ctx> ArrayLikeValue<'ctx> for ArrayAllocaValue<'ctx> { ) -> IntValue<'ctx> { self.1 } +} +impl<'ctx> ArrayLikeIndexer<'ctx> for ArrayAllocaValue<'ctx> { unsafe fn ptr_offset_unchecked( &self, ctx: &mut CodeGenContext<'ctx, '_>, @@ -247,6 +242,9 @@ impl<'ctx> ArrayLikeValue<'ctx> for ArrayAllocaValue<'ctx> { } } +impl<'ctx> UntypedArrayLikeAccessor<'ctx> for ArrayAllocaValue<'ctx> {} +impl<'ctx> UntypedArrayLikeMutator<'ctx> for ArrayAllocaValue<'ctx> {} + #[cfg(not(debug_assertions))] pub fn assert_is_list<'ctx>(_value: PointerValue<'ctx>, _llvm_usize: IntType<'ctx>) {}