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.

transPointerCastExpr

Same as transExpr but adds a & if the expression is an identifier referencing a function type.

Translator.transPointerCastExpr
fn transPointerCastExpr(t: *Translator, scope: *Scope, expr: Node.Index) TransError!ZigNode

File

lib/compiler/translate-c/Translator.zig:2716

Code

fn transPointerCastExpr(t: *Translator, scope: *Scope, expr: Node.Index) TransError!ZigNode {
    const sub_expr_node = try t.transExpr(scope, expr, .used);
    switch (expr.get(t.tree)) {
        .cast => |cast| if (cast.kind == .function_to_pointer and sub_expr_node.tag() == .identifier) {
            return ZigTag.address_of.create(t.arena, sub_expr_node);
        },
        else => {},
    }
    return sub_expr_node;
}