add pointer Layout

This commit is contained in:
Folkert 2020-03-20 11:53:21 +01:00
parent e4566b9757
commit fbadd9d620
3 changed files with 10 additions and 1 deletions

View file

@ -10,7 +10,7 @@ pub fn type_from_layout(cfg: TargetFrontendConfig, layout: &Layout<'_>) -> Type
use roc_mono::layout::Layout::*;
match layout {
FunctionPointer(_, _) | Struct(_) | Union(_) => cfg.pointer_type(),
FunctionPointer(_, _) | Pointer(_) | Struct(_) | Union(_) => cfg.pointer_type(),
Builtin(builtin) => match builtin {
Int64 => types::I64,
Float64 => types::F64,

View file

@ -59,6 +59,9 @@ pub fn basic_type_from_layout<'ctx>(
ptr_type.as_basic_type_enum()
}
Pointer(layout) => basic_type_from_layout(arena, context, &layout, ptr_bytes)
.ptr_type(AddressSpace::Generic)
.into(),
Struct(sorted_fields) => {
// Determine types
let mut field_types = Vec::with_capacity_in(sorted_fields.len(), arena);