From de3eeacfa0151243e4ef52af3d6c2e2b731fc720 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 17 Feb 2024 16:56:19 -0500 Subject: Major cleanup --- types.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'types.h') diff --git a/types.h b/types.h index fa0c7bff..af42c38a 100644 --- a/types.h +++ b/types.h @@ -41,6 +41,7 @@ struct type_s { ArrayType, TableType, FunctionType, + ClosureType, PointerType, StructType, EnumType, @@ -70,6 +71,9 @@ struct type_s { arg_t *args; type_t *ret; } FunctionType; + struct { + type_t *fn; + } ClosureType; struct { type_t *pointed; bool is_optional:1, is_stack:1, is_readonly:1; @@ -95,9 +99,9 @@ struct type_s { int printf_pointer_size(const struct printf_info *info, size_t n, int argtypes[n], int size[n]); int printf_type(FILE *stream, const struct printf_info *info, const void *const args[]); -const char* type_to_string_concise(type_t *t); -const char* type_to_typeof_string(type_t *t); -const char* type_to_string(type_t *t); +const char *type_to_string_concise(type_t *t); +const char *type_to_typeof_string(type_t *t); +const char *type_to_string(type_t *t); bool type_eq(type_t *a, type_t *b); bool type_is_a(type_t *t, type_t *req); type_t *type_or_type(type_t *a, type_t *b); @@ -112,5 +116,10 @@ bool can_leave_uninitialized(type_t *t); bool can_have_cycles(type_t *t); type_t *table_entry_type(type_t *table_t); type_t *replace_type(type_t *t, type_t *target, type_t *replacement); +size_t type_size(type_t *t); +size_t type_align(type_t *t); +type_t *iteration_key_type(type_t *iterable); +type_t *iteration_value_type(type_t *iterable); +type_t *get_field_type(type_t *t, const char *field_name); // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 -- cgit v1.2.3