From cd94b35f0c6e6855f10d54d33c83c78d69a409da Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Sat, 26 Jun 2021 22:38:33 -0500 Subject: [PATCH] small updates to type_info and added untyped_array --- core/container/array.onyx | 10 ++++++++++ core/type_info/type_info.onyx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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; -- 2.25.1