From: Brendan Hansen Date: Sun, 27 Jun 2021 03:38:33 +0000 (-0500) Subject: small updates to type_info and added untyped_array X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=cd94b35f0c6e6855f10d54d33c83c78d69a409da;p=onyx.git small updates to type_info and added untyped_array --- diff --git a/core/container/array.onyx b/core/container/array.onyx index 7c3f25b0..6dad7f08 100644 --- a/core/container/array.onyx +++ b/core/container/array.onyx @@ -379,3 +379,13 @@ least :: #match { (arr: [] $T) -> (i32, T) { return fold_idx_elem(arr.data, arr.count, cmp_less); }, (arr: [$N] $T) -> (i32, T) { return fold_idx_elem(cast(^T) arr, N, cmp_less); }, } + + +// Useful structure when talking about dynamic arrays where you don't know of what +// type they store. For example, when passing a dynamic array as an 'any' argument. +Untyped_Array :: struct { + data: rawptr; + count: u32; + capacity: u32; + allocator: Allocator; +} diff --git a/core/type_info/type_info.onyx b/core/type_info/type_info.onyx index 8c26dd27..512970ea 100644 --- a/core/type_info/type_info.onyx +++ b/core/type_info/type_info.onyx @@ -133,7 +133,7 @@ Type_Info_Struct :: struct { Member :: struct { name: str; offset: u32; - type_index: type_expr; + type: type_expr; used: bool; has_default: bool;