feature. See also
. The project being documented here (as the example) is the Zig library itself.
Manifest.copyErrorsIntoBundle
pub fn copyErrorsIntoBundle(
man: Manifest,
ast: Ast,
src_path: u32,
eb: *std.zig.ErrorBundle.Wip,
) Allocator.Error!void
File
Code
pub fn copyErrorsIntoBundle(
man: Manifest,
ast: Ast,
src_path: u32,
eb: *std.zig.ErrorBundle.Wip,
) Allocator.Error!void {
for (man.errors) |msg| {
const start_loc = ast.tokenLocation(0, msg.tok);
try eb.addRootErrorMessage(.{
.msg = try eb.addString(msg.msg),
.src_loc = try eb.addSourceLocation(.{
.src_path = src_path,
.span_start = ast.tokenStart(msg.tok),
.span_end = @intCast(ast.tokenStart(msg.tok) + ast.tokenSlice(msg.tok).len),
.span_main = ast.tokenStart(msg.tok) + msg.off,
.line = @intCast(start_loc.line),
.column = @intCast(start_loc.column),
.source_line = try eb.addString(ast.source[start_loc.line_start..start_loc.line_end]),
}),
});
}
}