const LocalPtr = struct base: Scope = Scope{ .tag = base_tag }parent: *ScopeParents can be: LocalVal, LocalPtr, GenZir, Defer, Namespace.
gen_zir: *GenZirptr: 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.
used_as_lvalue: bool = falseWhether this value is used as an lvalue after initialization. If not, we know it can be const, so will emit a compile error if it is var.
name: Zir.NullTerminatedStringString table index.
id_cat: IdCatmaybe_comptime: booltrue means we find out during Sema whether the value is comptime. false means it is already known at AstGen the value is runtime-known.
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194 const LocalPtr = struct {
const base_tag: Tag = .local_ptr;
base: Scope = Scope{ .tag = base_tag },
/// Parents can be: `LocalVal`, `LocalPtr`, `GenZir`, `Defer`, `Namespace`.
parent: *Scope,
gen_zir: *GenZir,
ptr: 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,
/// Whether this value is used as an lvalue after initialization.
/// If not, we know it can be `const`, so will emit a compile error if it is `var`.
used_as_lvalue: bool = false,
/// String table index.
name: Zir.NullTerminatedString,
id_cat: IdCat,
/// true means we find out during Sema whether the value is comptime.
/// false means it is already known at AstGen the value is runtime-known.
maybe_comptime: bool,
}
This could be a
constorvarlocal. It has a pointer instead of a value. This structure lives as long as the AST generation of the Block node that contains the variable.