DoxigAlpha

insertValue

Function parameters

Parameters

#
self:*WipFunction
indices:[]const u32
name:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

= 16

Values

#

Source

Implementation

#
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();
}