diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-01-02 16:24:07 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-01-02 16:24:07 -0500 |
| commit | be384c0caa92cb152c264125fb265373e6a50440 (patch) | |
| tree | b823fb0dd4cfec643670236688a2a7ca76787d7b /types.c | |
| parent | 2fcf1939bb295887592c1f24f7b8fbb10efcfcba (diff) | |
Replace threads with generic mutexed datastructures.
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 37 |
1 files changed, 0 insertions, 37 deletions
@@ -37,10 +37,6 @@ CORD type_to_cord(type_t *t) { auto array = Match(t, ArrayType); return CORD_asprintf("[%r]", type_to_cord(array->item_type)); } - case ChannelType: { - auto array = Match(t, ChannelType); - return CORD_asprintf("||%r", type_to_cord(array->item_type)); - } case TableType: { auto table = Match(t, TableType); if (table->default_value) @@ -245,7 +241,6 @@ PUREFUNC bool has_heap_memory(type_t *t) { switch (t->tag) { case ArrayType: return true; - case ChannelType: return true; case TableType: return true; case SetType: return true; case PointerType: return true; @@ -269,32 +264,6 @@ PUREFUNC bool has_heap_memory(type_t *t) } } -PUREFUNC bool can_send_over_channel(type_t *t) -{ - switch (t->tag) { - case ArrayType: return true; - case ChannelType: return true; - case TableType: return true; - case PointerType: return false; - case OptionalType: return can_send_over_channel(Match(t, OptionalType)->type); - case StructType: { - for (arg_t *field = Match(t, StructType)->fields; field; field = field->next) { - if (!can_send_over_channel(field->type)) - return false; - } - return true; - } - case EnumType: { - for (tag_t *tag = Match(t, EnumType)->tags; tag; tag = tag->next) { - if (tag->type && !can_send_over_channel(tag->type)) - return false; - } - return true; - } - default: return true; - } -} - PUREFUNC bool has_stack_memory(type_t *t) { switch (t->tag) { @@ -523,7 +492,6 @@ PUREFUNC size_t type_size(type_t *t) case TextType: return sizeof(Text_t); case ArrayType: return sizeof(Array_t); case SetType: return sizeof(Table_t); - case ChannelType: return sizeof(Channel_t*); case TableType: return sizeof(Table_t); case FunctionType: return sizeof(void*); case ClosureType: return sizeof(struct {void *fn, *userdata;}); @@ -607,7 +575,6 @@ PUREFUNC size_t type_align(type_t *t) case TextType: return __alignof__(Text_t); case SetType: return __alignof__(Table_t); case ArrayType: return __alignof__(Array_t); - case ChannelType: return __alignof__(Channel_t*); case TableType: return __alignof__(Table_t); case FunctionType: return __alignof__(void*); case ClosureType: return __alignof__(struct {void *fn, *userdata;}); @@ -706,10 +673,6 @@ type_t *get_field_type(type_t *t, const char *field_name) else if (streq(field_name, "microseconds")) return Type(IntType, .bits=TYPE_IBITS64); return NULL; } - case ChannelType: { - if (streq(field_name, "max_size")) return INT_TYPE; - return NULL; - } default: return NULL; } } |
