This commit is contained in:
agra
2026-03-02 09:49:43 +02:00
parent f763765ea2
commit ba9c4d69ce
6 changed files with 460 additions and 103 deletions

View File

@@ -195,6 +195,10 @@ pub const Builder = struct {
if (self.func == null) return .s64;
const func = self.currentFunc();
const ref_idx = @intFromEnum(ref);
// Check function parameters first (refs 0..N-1)
if (ref_idx < func.params.len) {
return func.params[ref_idx].ty;
}
for (func.blocks.items) |*block| {
const first = block.first_ref;
if (ref_idx >= first and ref_idx < first + @as(u32, @intCast(block.insts.items.len))) {