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. Private Function
Similar to expr, but intended for use when gz corresponds to a body which will contain only this node's code. Differs from expr in that if the root expression is an unlabeled block, does not emit an actual block. Instead, the block contents are emitted directly into gz.
fnfullBodyExpr(
gz: *GenZir,
scope: *Scope,
ri: ResultInfo,
node: Ast.Node.Index,
block_kind: BlockKind,
) InnerError!Zir.Inst.Ref {
consttree = gz.astgen.tree;
varstmt_buf: [2]Ast.Node.Index = undefined;
conststatements = tree.blockStatements(&stmt_buf, node) orelsereturnexpr(gz, scope, ri, node);
constlbrace = tree.nodeMainToken(node);
if (tree.isTokenPrecededByTags(lbrace, &.{ .identifier, .colon })) {
// Labeled blocks are tricky - forwarding result location information properly is non-trivial,// plus if this block is exited with a `break_inline` we aren't allowed multiple breaks. This// case is rare, so just treat it as a normal expression and create a nested block.returnblockExpr(gz, scope, ri, node, statements, block_kind);
}
varsub_gz = gz.makeSubBlock(scope);
tryblockExprStmts(&sub_gz, &sub_gz.base, statements, block_kind);
returnrvalue(gz, ri, .void_value, node);
}
Similar to
expr, but intended for use whengzcorresponds to a body which will contain only this node's code. Differs fromexprin that if the root expression is an unlabeled block, does not emit an actual block. Instead, the block contents are emitted directly intogz.