DoxigAlpha

insertElement

Function parameters

Parameters

#
self:*WipFunction
name:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

= 16

Values

#

Source

Implementation

#
pub fn insertElement(
    self: *WipFunction,
    val: Value,
    elem: Value,
    index: Value,
    name: []const u8,
) Allocator.Error!Value {
    assert(val.typeOfWip(self).scalarType(self.builder) == elem.typeOfWip(self));
    assert(index.typeOfWip(self).isInteger(self.builder));
    try self.ensureUnusedExtraCapacity(1, Instruction.InsertElement, 0);
    const instruction = try self.addInst(name, .{
        .tag = .insertelement,
        .data = self.addExtraAssumeCapacity(Instruction.InsertElement{
            .val = val,
            .elem = elem,
            .index = index,
        }),
    });
    return instruction.toValue();
}