mutable decl syntax change
This commit is contained in:
@@ -10,7 +10,7 @@ State :: struct {
|
||||
diagnostics std.ArrayList(ScanDiagnostic)
|
||||
}
|
||||
|
||||
arrlist_test std.ArrayList(Token) = arraylist.init(mem.c_allocator)
|
||||
arrlist_test std.ArrayList(Token) := arraylist.init(mem.c_allocator)
|
||||
|
||||
init func(allocator mem.Allocator) State {
|
||||
return State {
|
||||
@@ -44,11 +44,11 @@ run func() i32 ! mem.AllocError {
|
||||
state State :: init(mem.c_allocator)
|
||||
_ = state
|
||||
|
||||
values std.ArrayList(i32) = arraylist.init(mem.c_allocator)
|
||||
values std.ArrayList(i32) := arraylist.init(mem.c_allocator)
|
||||
defer arraylist.deinit(&values)
|
||||
if (values.items.len != 0 or values.capacity != 0) return 1
|
||||
|
||||
i usize = 0
|
||||
i usize := 0
|
||||
while i < 20 : i += 1 {
|
||||
arraylist.append(&values, i32(i)) catch |_| {
|
||||
return .out_of_memory
|
||||
@@ -71,7 +71,7 @@ run func() i32 ! mem.AllocError {
|
||||
}
|
||||
if (values.items.len != 1 or values.items[0] != 7 or values.capacity != capacity) return 7
|
||||
|
||||
empty_values arraylist.ArrayList([0]u8) = arraylist.init(mem.c_allocator)
|
||||
empty_values arraylist.ArrayList([0]u8) := arraylist.init(mem.c_allocator)
|
||||
defer arraylist.deinit(&empty_values)
|
||||
zero [0]u8 :: []
|
||||
arraylist.append(&empty_values, zero) catch |_| {
|
||||
@@ -79,8 +79,8 @@ run func() i32 ! mem.AllocError {
|
||||
}
|
||||
if (empty_values.items.len != 1) return 8
|
||||
|
||||
failed arraylist.ArrayList(i32) = arraylist.init(i32, fail_allocator)
|
||||
failed_as_expected bool = false
|
||||
failed arraylist.ArrayList(i32) := arraylist.init(i32, fail_allocator)
|
||||
failed_as_expected bool := false
|
||||
arraylist.append(&failed, 1) catch |_| {
|
||||
failed_as_expected = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user