Function insertElement [src]

Prototype

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

Parameters

self: *WipFunctionval: Valueelem: Valueindex: Valuename: []const u8

Source

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