stage2: get rid of "unable to monomorphize function" error
This commit solves the problem in a much simpler way: putting runtime-known values in place of non-comptime arguments when instantiating a generic function.
This commit is contained in:
@@ -1376,6 +1376,16 @@ pub const Scope = struct {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn addArg(block: *Block, ty: Type, name: u32) error{OutOfMemory}!Air.Inst.Ref {
|
||||
return block.addInst(.{
|
||||
.tag = .arg,
|
||||
.data = .{ .ty_str = .{
|
||||
.ty = try block.sema.addType(ty),
|
||||
.str = name,
|
||||
} },
|
||||
});
|
||||
}
|
||||
|
||||
pub fn addInst(block: *Block, inst: Air.Inst) error{OutOfMemory}!Air.Inst.Ref {
|
||||
return Air.indexToRef(try block.addInstAsIndex(inst));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user