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 library itself.

walkFieldAccesses

html_render.walkFieldAccesses
fn walkFieldAccesses(
    file_index: Walk.File.Index,
    out: *ArrayList(u8),
    node: Ast.Node.Index,
) Oom!void

File

lib/docs/wasm/html_render.zig:362

Code

fn walkFieldAccesses(
    file_index: Walk.File.Index,
    out: *ArrayList(u8),
    node: Ast.Node.Index,
) Oom!void {
    const ast = file_index.get_ast();
    assert(ast.nodeTag(node) == .field_access);
    const object_node, const field_ident = ast.nodeData(node).node_and_token;
    switch (ast.nodeTag(object_node)) {
        .identifier => {
            const lhs_ident = ast.nodeMainToken(object_node);
            try resolveIdentLink(file_index, out, lhs_ident);
        },
        .field_access => {
            try walkFieldAccesses(file_index, out, object_node);
        },
        else => {},
    }
    if (out.items.len > 0) {
        try out.append(gpa, '.');
        try out.appendSlice(gpa, ast.tokenSlice(field_ident));
    }
}