aboutsummaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-11 01:31:31 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-11 01:31:31 -0400
commit7126755275f12e6278031e78ff33f65801b133dd (patch)
tree7f43f3449eb7bb69b0879dd41eb174e89fdc34cc /types.h
parent89234e34e292861fccb8e5bdbefc695a7e443eea (diff)
Add optional types
Diffstat (limited to 'types.h')
-rw-r--r--types.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/types.h b/types.h
index 95b4d4c0..82efab37 100644
--- a/types.h
+++ b/types.h
@@ -57,6 +57,7 @@ struct type_s {
PointerType,
StructType,
EnumType,
+ OptionalType,
TypeInfoType,
ModuleType,
} tag;
@@ -97,7 +98,7 @@ struct type_s {
} ClosureType;
struct {
type_t *pointed;
- bool is_optional:1, is_stack:1, is_readonly:1;
+ bool is_stack:1, is_readonly:1;
} PointerType;
struct {
const char *name;
@@ -112,6 +113,9 @@ struct type_s {
struct env_s *env;
} EnumType;
struct {
+ type_t *type;
+ } OptionalType;
+ struct {
const char *name;
type_t *type;
struct env_s *env;
@@ -139,11 +143,9 @@ PUREFUNC bool has_heap_memory(type_t *t);
PUREFUNC bool has_stack_memory(type_t *t);
PUREFUNC bool can_send_over_channel(type_t *t);
PUREFUNC bool can_promote(type_t *actual, type_t *needed);
-PUREFUNC bool can_leave_uninitialized(type_t *t);
-PUREFUNC bool can_have_cycles(type_t *t);
PUREFUNC bool is_int_type(type_t *t);
PUREFUNC bool is_numeric_type(type_t *t);
-type_t *replace_type(type_t *t, type_t *target, type_t *replacement);
+PUREFUNC bool supports_optionals(type_t *t);
PUREFUNC size_t type_size(type_t *t);
PUREFUNC size_t type_align(type_t *t);
PUREFUNC size_t padded_type_size(type_t *t);