stlib arraylist

This commit is contained in:
2026-07-12 13:38:29 +02:00
parent b0c716537e
commit 0706188b98
16 changed files with 600 additions and 22 deletions
+16
View File
@@ -75,6 +75,7 @@ Kind :: enum u8 {
Struct,
Union,
Fallible,
Type_Call,
}
Node :: struct {
@@ -359,6 +360,21 @@ struct_anonymous :: proc(store: ^Store, fields: []Field) -> Type {
})
}
// Generated structs are nominal per comptime type-expression specialization.
// The checker owns canonicalization; this routine deliberately creates a fresh node.
struct_generated :: proc(store: ^Store, fields: []Field) -> Type {
start := u32(len(store.fields))
append(&store.fields, ..fields)
id := DYNAMIC_START+Type(len(store.nodes))
append(&store.nodes, Node{
kind=.Struct,
field_start=start,
field_count=u32(len(fields)),
declared=true,
})
return id
}
variant_id :: proc(store: ^Store, name: u32, payload: Type) -> (u16, bool) {
for variant in store.variants {
if variant.name == name && variant.payload == payload {