mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
std.Zir: some declaration traversal fixes
This commit is contained in:
parent
ee695c8ef4
commit
5093a5cd19
@ -3791,11 +3791,15 @@ fn findDeclsSwitch(
|
||||
break :blk multi_cases_len;
|
||||
} else 0;
|
||||
|
||||
if (extra.data.bits.any_has_tag_capture) {
|
||||
extra_index += 1;
|
||||
}
|
||||
|
||||
const special_prong = extra.data.bits.specialProng();
|
||||
if (special_prong != .none) {
|
||||
const body_len: u31 = @truncate(zir.extra[extra_index]);
|
||||
const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
|
||||
extra_index += 1;
|
||||
const body = zir.bodySlice(extra_index, body_len);
|
||||
const body = zir.bodySlice(extra_index, prong_info.body_len);
|
||||
extra_index += body.len;
|
||||
|
||||
try zir.findDeclsBody(list, body);
|
||||
@ -3805,10 +3809,10 @@ fn findDeclsSwitch(
|
||||
const scalar_cases_len = extra.data.bits.scalar_cases_len;
|
||||
for (0..scalar_cases_len) |_| {
|
||||
extra_index += 1;
|
||||
const body_len: u31 = @truncate(zir.extra[extra_index]);
|
||||
const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
|
||||
extra_index += 1;
|
||||
const body = zir.bodySlice(extra_index, body_len);
|
||||
extra_index += body_len;
|
||||
const body = zir.bodySlice(extra_index, prong_info.body_len);
|
||||
extra_index += body.len;
|
||||
|
||||
try zir.findDeclsBody(list, body);
|
||||
}
|
||||
@ -3819,20 +3823,13 @@ fn findDeclsSwitch(
|
||||
extra_index += 1;
|
||||
const ranges_len = zir.extra[extra_index];
|
||||
extra_index += 1;
|
||||
const body_len: u31 = @truncate(zir.extra[extra_index]);
|
||||
const prong_info: Inst.SwitchBlock.ProngInfo = @bitCast(zir.extra[extra_index]);
|
||||
extra_index += 1;
|
||||
const items = zir.refSlice(extra_index, items_len);
|
||||
extra_index += items_len;
|
||||
_ = items;
|
||||
|
||||
var range_i: usize = 0;
|
||||
while (range_i < ranges_len) : (range_i += 1) {
|
||||
extra_index += 1;
|
||||
extra_index += 1;
|
||||
}
|
||||
extra_index += items_len + ranges_len * 2;
|
||||
|
||||
const body = zir.bodySlice(extra_index, body_len);
|
||||
extra_index += body_len;
|
||||
const body = zir.bodySlice(extra_index, prong_info.body_len);
|
||||
extra_index += body.len;
|
||||
|
||||
try zir.findDeclsBody(list, body);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user