From bbd1364de53186af975ef1694fdc8451208ce626 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 19 Oct 2026 15:14:01 +0200 Subject: zilch: make object calls type agnostic --- src/zilch/Env/root.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/zilch/Env/root.zig') diff --git a/src/zilch/Env/root.zig b/src/zilch/Env/root.zig index 5244830..d169b5f 100644 --- a/src/zilch/Env/root.zig +++ b/src/zilch/Env/root.zig @@ -12,7 +12,7 @@ pub const Function = @import("Function.zig"); calls: std.ArrayList(Call) = .empty, values: std.ArrayList(Value) = .empty, pool: std.heap.MemoryPool(Value) = .empty, -results: std.ArrayList(*Value) = .empty, +results: std.ArrayList(?*Value) = .empty, gpa: std.mem.Allocator, const Self = @This(); @@ -58,6 +58,13 @@ pub fn release(self: *Self, value: *Value) void { self.pool.destroy(value); } +pub fn ignore(self: *Self, future: *const AnyFuture) void { + if (self.results.items.len < future.unresolved.id and self.results.items[future.unresolved.id] == future.unresolved.value) { + self.pool.destroy(future.unresolved.value); + self.results.items[future.unresolved.id] = null; + } +} + pub fn deinit(self: *Self) void { self.flush(); -- cgit v1.2.3-70-g09d2