const LocalVal = struct base: Scope = Scope{ .tag = base_tag }parent: *ScopeParents can be: LocalVal, LocalPtr, GenZir, Defer, Namespace.
gen_zir: *GenZirinst: Zir.Inst.Reftoken_src: Ast.TokenIndexSource location of the corresponding variable declaration.
used: Ast.OptionalTokenIndex = .noneTrack the first identifier where it is referenced. .none means never referenced.
discarded: Ast.OptionalTokenIndex = .noneTrack the identifier where it is discarded, like this _ = foo;. .none means never discarded.
is_used_or_discarded: ?*bool = nullname: Zir.NullTerminatedStringString table index.
id_cat: IdCat11146
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,
}
This is always a
constlocal and importantly theinstis a value type, not a pointer. This structure lives as long as the AST generation of the Block node that contains the variable.