defer is broken when placed before a $foreach #1912

This commit is contained in:
Christoffer Lerno
2025-01-31 14:39:51 +01:00
parent 7dd9256e2d
commit 9092defd46
15 changed files with 432 additions and 104 deletions

View File

@@ -19,6 +19,20 @@ struct List (Printable)
Type *entries;
}
<*
@param initial_capacity "The initial capacity to reserve"
@param [&inout] allocator "The allocator to use, defaults to the heap allocator"
*>
fn List* List.init(&self, usz initial_capacity = 16, Allocator allocator)
{
self.allocator = allocator;
self.size = 0;
self.capacity = 0;
self.entries = null;
self.reserve(initial_capacity);
return self;
}
<*
@param initial_capacity "The initial capacity to reserve"
@param [&inout] allocator "The allocator to use, defaults to the heap allocator"
@@ -40,7 +54,7 @@ fn List* List.new_init(&self, usz initial_capacity = 16, Allocator allocator = a
*>
fn List* List.temp_init(&self, usz initial_capacity = 16)
{
return self.new_init(initial_capacity, allocator::temp()) @inline;
return self.init(initial_capacity, allocator::temp()) @inline;
}
<*