struct field declared type inference
This commit is contained in:
@@ -12,6 +12,13 @@ State :: struct {
|
||||
|
||||
arrlist_test std.ArrayList(Token) = arraylist.init(mem.c_allocator)
|
||||
|
||||
init func(allocator mem.Allocator) State {
|
||||
return State {
|
||||
tokens = arraylist.init(allocator),
|
||||
diagnostics = arraylist.init(allocator),
|
||||
}
|
||||
}
|
||||
|
||||
hide fail_alloc func(_ ?@mut anyopaque, _ usize, _ usize) ?*mut u8 {
|
||||
return none
|
||||
}
|
||||
@@ -34,6 +41,9 @@ hide fail_allocator mem.Allocator :: mem.Allocator {
|
||||
}
|
||||
|
||||
run func() i32 ! mem.AllocError {
|
||||
state State :: init(mem.c_allocator)
|
||||
_ = state
|
||||
|
||||
values std.ArrayList(i32) = arraylist.init(mem.c_allocator)
|
||||
defer arraylist.deinit(&values)
|
||||
if (values.items.len != 0 or values.capacity != 0) return 1
|
||||
|
||||
Reference in New Issue
Block a user