authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-07-16 19:35:31+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-07-16 19:44:15+01:00
log5093a5cd193ed3cd4107f0fcdb0ed1ab9dda30f5
treee7ae983fd3a20ba67dafad3062a3cbf0c2e2473e
parentee695c8ef40ae7cecb4b9a77c8a6dcbe53d4f013
signaturelock-open Commit is signed but in an unrecognized format.

std.Zir: some declaration traversal fixes


1 files changed, 13 insertions(+), 16 deletions(-)

lib/std/zig/Zir.zig+13-16
......@@ -3791,11 +3791,15 @@ fn findDeclsSwitch(
37913791 break :blk multi_cases_len;
37923792 } else 0;
37933793
3794 if (extra.data.bits.any_has_tag_capture) {
3795 extra_index += 1;
3796 }
3797
37943798 const special_prong = extra.data.bits.specialProng();
37953799 if (special_prong != .none) {
3796 const body_len: u31 = @truncate(zir.extra[extra_index]);
3800 const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
37973801 extra_index += 1;
3798 const body = zir.bodySlice(extra_index, body_len);
3802 const body = zir.bodySlice(extra_index, prong_info.body_len);
37993803 extra_index += body.len;
38003804
38013805 try zir.findDeclsBody(list, body);
......@@ -3805,10 +3809,10 @@ fn findDeclsSwitch(
38053809 const scalar_cases_len = extra.data.bits.scalar_cases_len;
38063810 for (0..scalar_cases_len) |_| {
38073811 extra_index += 1;
3808 const body_len: u31 = @truncate(zir.extra[extra_index]);
3812 const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
38093813 extra_index += 1;
3810 const body = zir.bodySlice(extra_index, body_len);
3811 extra_index += body_len;
3814 const body = zir.bodySlice(extra_index, prong_info.body_len);
3815 extra_index += body.len;
38123816
38133817 try zir.findDeclsBody(list, body);
38143818 }
......@@ -3819,20 +3823,13 @@ fn findDeclsSwitch(
38193823 extra_index += 1;
38203824 const ranges_len = zir.extra[extra_index];
38213825 extra_index += 1;
3822 const body_len: u31 = @truncate(zir.extra[extra_index]);
3826 const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
38233827 extra_index += 1;
3824 const items = zir.refSlice(extra_index, items_len);
3825 extra_index += items_len;
3826 _ = items;
38273828
3828 var range_i: usize = 0;
3829 while (range_i < ranges_len) : (range_i += 1) {
3830 extra_index += 1;
3831 extra_index += 1;
3832 }
3829 extra_index += items_len + ranges_len * 2;
38333830
3834 const body = zir.bodySlice(extra_index, body_len);
3835 extra_index += body_len;
3831 const body = zir.bodySlice(extra_index, prong_info.body_len);
3832 extra_index += body.len;
38363833
38373834 try zir.findDeclsBody(list, body);
38383835 }