mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
fix ZIR decoding of error notes
This commit is contained in:
parent
974a6fe757
commit
23295f64ca
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user