Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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

makeDeclaration

Private Function
std.zig.AstGen.GenZir.makeDeclaration
fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index

Note that this returns a Zir.Inst.Index not a ref. Does not append the block instruction to the scope. Leaves the payload_index field undefined. Use setDeclaration to finalize.

Params

File

zig/AstGen.zig:12389
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
    fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index {
        const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len));
        try gz.astgen.instructions.append(gz.astgen.gpa, .{
            .tag = .declaration,
            .data = .{ .declaration = .{
                .src_node = node,
                .payload_index = undefined,
            } },
        });
        return new_index;
    }