authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-09 14:17:25-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:14-07:00
log23295f64ca8b93f32e75cef42cc1293ec334e890
treeedb46c61f32219966c1796f4008ba41ac3fabeae
parent974a6fe757fd53873e7dace177ad3ae3c425b504

fix ZIR decoding of error notes


3 files changed, 9 insertions(+), 3 deletions(-)

src/AstGen.zig+2-2
......@@ -10382,7 +10382,7 @@ fn appendErrorTok(
1038210382 comptime format: []const u8,
1038310383 args: anytype,
1038410384) !void {
10385 try astgen.appendErrorTokNotes(token, format, args, &[0]u32{});
10385 try astgen.appendErrorTokNotesOff(token, 0, format, args, &[0]u32{});
1038610386}
1038710387
1038810388fn failTokNotes(
......@@ -10392,7 +10392,7 @@ fn failTokNotes(
1039210392 args: anytype,
1039310393 notes: []const u32,
1039410394) InnerError {
10395 try appendErrorTokNotes(astgen, token, format, args, notes);
10395 try appendErrorTokNotesOff(astgen, token, 0, format, args, notes);
1039610396 return error.AnalysisFail;
1039710397}
1039810398
src/Compilation.zig+1-1
......@@ -2909,7 +2909,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void {
29092909 .column = @intCast(u32, err_loc.column),
29102910 .source_line = try eb.addString(err_loc.source_line),
29112911 }),
2912 .notes_len = item.data.notes,
2912 .notes_len = item.data.notesLen(file.zir),
29132913 });
29142914 }
29152915
src/Zir.zig+6
......@@ -3594,6 +3594,12 @@ pub const Inst = struct {
35943594 /// 0 or a payload index of a `Block`, each is a payload
35953595 /// index of another `Item`.
35963596 notes: u32,
3597
3598 pub fn notesLen(item: Item, zir: Zir) u32 {
3599 if (item.notes == 0) return 0;
3600 const block = zir.extraData(Block, item.notes);
3601 return block.data.body_len;
3602 }
35973603 };
35983604 };
35993605