authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-15 18:57:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-15 18:57:36-07:00
logba623b160ed43b720a6c653a24e9efb91f52d326
tree3b30dfe43d9998a62bb8b3899956b3c78667b36a
parent60318a1e39897a0535cf7699c2e4ab6366d0687f

Zir: fix wrong union field access for declaration


1 files changed, 6 insertions(+), 4 deletions(-)

lib/std/zig/Zir.zig+6-4
......@@ -1,5 +1,7 @@
1//! Zig Intermediate Representation. Astgen.zig converts AST nodes to these
2//! untyped IR instructions. Next, Sema.zig processes these into AIR.
1//! Zig Intermediate Representation.
2//!
3//! Astgen.zig converts AST nodes to these untyped IR instructions. Next,
4//! Sema.zig processes these into AIR.
35//! The minimum amount of information needed to represent a list of ZIR instructions.
46//! Once this structure is completed, it can be used to generate AIR, followed by
57//! machine code, without any memory access into the AST tree token list, node list,
......@@ -4024,8 +4026,8 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
40244026 const data = zir.instructions.items(.data);
40254027 switch (tag[@intFromEnum(inst)]) {
40264028 .declaration => {
4027 const pl_node = data[@intFromEnum(inst)].pl_node;
4028 const extra = zir.extraData(Inst.Declaration, pl_node.payload_index);
4029 const declaration = data[@intFromEnum(inst)].declaration;
4030 const extra = zir.extraData(Inst.Declaration, declaration.payload_index);
40294031 return @bitCast([4]u32{
40304032 extra.data.src_hash_0,
40314033 extra.data.src_hash_1,