forked from M-Labs/nac3
1
0
Fork 0

core/classes: Fix incorrect field locations for lists

This commit is contained in:
David Mak 2024-06-11 15:17:02 +08:00
parent 210d9e2334
commit 679656f9e1
1 changed files with 5 additions and 3 deletions

View File

@ -541,18 +541,20 @@ impl<'ctx> ListType<'ctx> {
self.as_base_type() self.as_base_type()
.get_element_type() .get_element_type()
.into_struct_type() .into_struct_type()
.get_field_type_at_index(0) .get_field_type_at_index(1)
.map(BasicTypeEnum::into_int_type) .map(BasicTypeEnum::into_int_type)
.unwrap() .unwrap()
} }
/// Returns the element type of this `list` type. /// Returns the element type of this `list` type.
#[must_use] #[must_use]
pub fn element_type(&self) -> BasicTypeEnum<'ctx> { pub fn element_type(&self) -> AnyTypeEnum<'ctx> {
self.as_base_type() self.as_base_type()
.get_element_type() .get_element_type()
.into_struct_type() .into_struct_type()
.get_field_type_at_index(1) .get_field_type_at_index(0)
.map(BasicTypeEnum::into_pointer_type)
.map(PointerType::get_element_type)
.unwrap() .unwrap()
} }
} }