Function insertValue [src]

Prototype

pub fn insertValue( self: *WipFunction, val: Value, elem: Value, indices: []const u32, name: []const u8, ) Allocator.Error!Value

Parameters

self: *WipFunctionval: Valueelem: Valueindices: []const u32name: []const u8

Source

pub fn insertValue( self: *WipFunction, val: Value, elem: Value, indices: []const u32, name: []const u8, ) Allocator.Error!Value { assert(indices.len > 0); assert(val.typeOfWip(self).childTypeAt(indices, self.builder) == elem.typeOfWip(self)); try self.ensureUnusedExtraCapacity(1, Instruction.InsertValue, indices.len); const instruction = try self.addInst(name, .{ .tag = .insertvalue, .data = self.addExtraAssumeCapacity(Instruction.InsertValue{ .val = val, .elem = elem, .indices_len = @intCast(indices.len), }), }); self.extra.appendSliceAssumeCapacity(indices); return instruction.toValue(); }