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.

addTopLevelDecl

Translator.addTopLevelDecl
pub fn addTopLevelDecl(t: *Translator, name: []const u8, decl_node: ZigNode) !void

File

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

Code

pub fn addTopLevelDecl(t: *Translator, name: []const u8, decl_node: ZigNode) !void {
    const gop = try t.global_scope.sym_table.getOrPut(t.gpa, name);
    if (gop.found_existing) return; // Any duplicate decls are equivalent
    gop.value_ptr.* = decl_node;
    try t.global_scope.nodes.append(t.gpa, decl_node);
}