stlib arraylist
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user