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 Struct

LocalVal

Private Struct
std.zig.AstGen.Scope.LocalVal
const LocalVal = struct

This is always a const local and importantly the inst is a value type, not a pointer. This structure lives as long as the AST generation of the Block node that contains the variable.

Fields

base: Scope = Scope{ .tag = base_tag }
parent: *Scope

Parents can be: LocalVal, LocalPtr, GenZir, Defer, Namespace.

gen_zir: *GenZir
inst: Zir.Inst.Ref
token_src: Ast.TokenIndex

Source location of the corresponding variable declaration.

used: Ast.OptionalTokenIndex = .none

Track the first identifier where it is referenced. .none means never referenced.

discarded: Ast.OptionalTokenIndex = .none

Track the identifier where it is discarded, like this _ = foo;. .none means never discarded.

is_used_or_discarded: ?*bool = null
name: Zir.NullTerminatedString

String table index.

id_cat: IdCat

Values

File

zig/AstGen.zig:11146
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
    const LocalVal = struct {
        const base_tag: Tag = .local_val;
        base: Scope = Scope{ .tag = base_tag },
        /// Parents can be: `LocalVal`, `LocalPtr`, `GenZir`, `Defer`, `Namespace`.
        parent: *Scope,
        gen_zir: *GenZir,
        inst: Zir.Inst.Ref,
        /// Source location of the corresponding variable declaration.
        token_src: Ast.TokenIndex,
        /// Track the first identifier where it is referenced.
        /// .none means never referenced.
        used: Ast.OptionalTokenIndex = .none,
        /// Track the identifier where it is discarded, like this `_ = foo;`.
        /// .none means never discarded.
        discarded: Ast.OptionalTokenIndex = .none,
        is_used_or_discarded: ?*bool = null,
        /// String table index.
        name: Zir.NullTerminatedString,
        id_cat: IdCat,
    }