diag: add stable source reasons and diagnostic incidence reporting
This commit is contained in:
1 parent
911982dd1c
commit
dbd9763713
21 files changed
+571
-156
No files matched your search
+3
-2
@@ -44,8 +44,9 @@ pub fn compileWithModules(arena: std.mem.Allocator, file: []const u8, source: []
|
||||
return switch (result) {
|
||||
.ok => |o| .{ .ok = o },
|
||||
.err => |p| blk: {
|
||||
const fields = try arena.alloc(diag.Field, p.fields.len);
|
||||
for (p.fields, fields) |pf, *f| f.* = .{ .name = pf.name, .value = .{ .str = pf.value } };
|
||||
const fields = try arena.alloc(diag.Field, p.fields.len + @intFromBool(p.reason != null));
|
||||
for (p.fields, fields[0..p.fields.len]) |pf, *f| f.* = .{ .name = pf.name, .value = .{ .str = pf.value } };
|
||||
if (p.reason) |reason| fields[p.fields.len] = .{ .name = "reason", .value = .{ .str = @tagName(reason) } };
|
||||
break :blk .{ .err = .{
|
||||
.code = diag.lookup(p.code).?,
|
||||
.span = .{ .file = p.span.file orelse file, .line = p.span.start.line, .col = p.span.start.col },
|
||||
|
||||
Reference in new issue
Block a user