Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › zig › AstGen › GenZir › addExtendedMultiOp Private Function addExtendedMultiOp Doc Source Private Function std.zig.AstGen.GenZir.addExtendedMultiOp
fn addExtendedMultiOp (
gz : *GenZir ,
opcode : Zir .Inst .Extended ,
node : Ast .Node .Index ,
operands : []const Zir .Inst .Ref ,
) !Zir .Inst .Ref Params gz : *GenZir opcode : Zir .Inst .Extended node : Ast .Node .Index operands : []const Zir .Inst .Ref File zig/AstGen.zig: 11905
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936 fn addExtendedMultiOp (
gz : *GenZir ,
opcode : Zir .Inst .Extended ,
node : Ast .Node .Index ,
operands : []const Zir .Inst .Ref ,
) !Zir .Inst .Ref {
const astgen = gz .astgen ;
const gpa = astgen .gpa ;
try gz .instructions .ensureUnusedCapacity (gpa , 1 );
try astgen .instructions .ensureUnusedCapacity (gpa , 1 );
try astgen .extra .ensureUnusedCapacity (
gpa ,
@typeInfo (Zir .Inst .NodeMultiOp ).@"struct" .field_names .len + operands .len ,
);
const payload_index = astgen .addExtraAssumeCapacity (Zir .Inst .NodeMultiOp {
.src_node = gz .nodeIndexToRelative (node ),
});
const new_index : Zir .Inst .Index = @fromBackingInt (@intCast (astgen .instructions .len ));
astgen .instructions .appendAssumeCapacity (.{
.tag = .extended ,
.data = .{ .extended = .{
.opcode = opcode ,
.small = @intCast (operands .len ),
.operand = payload_index ,
} },
});
gz .instructions .appendAssumeCapacity (new_index );
astgen .appendRefsAssumeCapacity (operands );
return new_index .toRef ();
}