Commit 23295f64ca
Changed files (3)
src/AstGen.zig
@@ -10382,7 +10382,7 @@ fn appendErrorTok(
comptime format: []const u8,
args: anytype,
) !void {
- try astgen.appendErrorTokNotes(token, format, args, &[0]u32{});
+ try astgen.appendErrorTokNotesOff(token, 0, format, args, &[0]u32{});
}
fn failTokNotes(
@@ -10392,7 +10392,7 @@ fn failTokNotes(
args: anytype,
notes: []const u32,
) InnerError {
- try appendErrorTokNotes(astgen, token, format, args, notes);
+ try appendErrorTokNotesOff(astgen, token, 0, format, args, notes);
return error.AnalysisFail;
}
src/Compilation.zig
@@ -2909,7 +2909,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void {
.column = @intCast(u32, err_loc.column),
.source_line = try eb.addString(err_loc.source_line),
}),
- .notes_len = item.data.notes,
+ .notes_len = item.data.notesLen(file.zir),
});
}
src/Zir.zig
@@ -3594,6 +3594,12 @@ pub const Inst = struct {
/// 0 or a payload index of a `Block`, each is a payload
/// index of another `Item`.
notes: u32,
+
+ pub fn notesLen(item: Item, zir: Zir) u32 {
+ if (item.notes == 0) return 0;
+ const block = zir.extraData(Block, item.notes);
+ return block.data.body_len;
+ }
};
};