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 › setCondBrPayload Private Function setCondBrPayload Doc Source Private Function std.zig.AstGen.setCondBrPayload
fn setCondBrPayload (
condbr : Zir .Inst .Index ,
cond : Zir .Inst .Ref ,
then_scope : *GenZir ,
else_scope : *GenZir ,
) !void Params File zig/AstGen.zig: 6347
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373 fn setCondBrPayload (
condbr : Zir .Inst .Index ,
cond : Zir .Inst .Ref ,
then_scope : *GenZir ,
else_scope : *GenZir ,
) !void {
defer then_scope .unstack ();
defer else_scope .unstack ();
const astgen = then_scope .astgen ;
const then_body = then_scope .instructionsSliceUpto (else_scope );
const else_body = else_scope .instructionsSlice ();
const then_body_len = astgen .countBodyLenAfterFixups (then_body );
const else_body_len = astgen .countBodyLenAfterFixups (else_body );
try astgen .extra .ensureUnusedCapacity (
astgen .gpa ,
@typeInfo (Zir .Inst .CondBr ).@"struct" .field_names .len + then_body_len + else_body_len ,
);
const zir_datas = astgen .instructions .items (.data );
zir_datas [@backingInt (condbr )].pl_node .payload_index = astgen .addExtraAssumeCapacity (Zir .Inst .CondBr {
.condition = cond ,
.then_body_len = then_body_len ,
.else_body_len = else_body_len ,
});
astgen .appendBodyWithFixups (then_body );
astgen .appendBodyWithFixups (else_body );
}
Supports
else_scopestacked onthen_scope. Unstackselse_scopethenthen_scope.