structstd.zig.Zir.DeclContents[src]

DeclContents contains all "interesting" instructions found within a declaration by findTrackable. These instructions are partitioned into a few different sets, since this makes ZIR instruction mapping more effective.

Fields

func_decl: ?Inst.Index

This is a simple optional because ZIR guarantees that a func/func_inferred/func_fancy instruction can only occur once per declaration.

explicit_types: std.ArrayListUnmanaged(Inst.Index)
other: std.ArrayListUnmanaged(Inst.Index)

Values

Constantinit[src]

Source Code

Source code
pub const init: DeclContents = .{
    .func_decl = null,
    .explicit_types = .empty,
    .other = .empty,
}

Functions

Functionclear[src]

pub fn clear(contents: *DeclContents) void

Parameters

contents: *DeclContents

Source Code

Source code
pub fn clear(contents: *DeclContents) void {
    contents.func_decl = null;
    contents.explicit_types.clearRetainingCapacity();
    contents.other.clearRetainingCapacity();
}

Functiondeinit[src]

pub fn deinit(contents: *DeclContents, gpa: Allocator) void

Parameters

contents: *DeclContents

Source Code

Source code
pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
    contents.explicit_types.deinit(gpa);
    contents.other.deinit(gpa);
}

Source Code

Source code
pub const DeclContents = struct {
    /// This is a simple optional because ZIR guarantees that a `func`/`func_inferred`/`func_fancy` instruction
    /// can only occur once per `declaration`.
    func_decl: ?Inst.Index,
    explicit_types: std.ArrayListUnmanaged(Inst.Index),
    other: std.ArrayListUnmanaged(Inst.Index),

    pub const init: DeclContents = .{
        .func_decl = null,
        .explicit_types = .empty,
        .other = .empty,
    };

    pub fn clear(contents: *DeclContents) void {
        contents.func_decl = null;
        contents.explicit_types.clearRetainingCapacity();
        contents.other.clearRetainingCapacity();
    }

    pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
        contents.explicit_types.deinit(gpa);
        contents.other.deinit(gpa);
    }
}