| ... | ... | @@ -505,6 +505,9 @@ pub const AllErrors = struct { |
| 505 | 505 | Message.HashContext, |
| 506 | 506 | std.hash_map.default_max_load_percentage, |
| 507 | 507 | ).init(allocator); |
| 508 | const err_source = try module_err_msg.src_loc.file_scope.getSource(module.gpa); |
| 509 | const err_byte_offset = try module_err_msg.src_loc.byteOffset(module.gpa); |
| 510 | const err_loc = std.zig.findLineColumn(err_source.bytes, err_byte_offset); |
| 508 | 511 | |
| 509 | 512 | for (module_err_msg.notes) |module_note| { |
| 510 | 513 | const source = try module_note.src_loc.file_scope.getSource(module.gpa); |
| ... | ... | @@ -519,7 +522,7 @@ pub const AllErrors = struct { |
| 519 | 522 | .byte_offset = byte_offset, |
| 520 | 523 | .line = @intCast(u32, loc.line), |
| 521 | 524 | .column = @intCast(u32, loc.column), |
| 522 | | .source_line = try allocator.dupe(u8, loc.source_line), |
| 525 | .source_line = if (err_loc.eql(loc)) null else try allocator.dupe(u8, loc.source_line), |
| 523 | 526 | }, |
| 524 | 527 | }; |
| 525 | 528 | const gop = try seen_notes.getOrPut(note); |
| ... | ... | @@ -537,19 +540,16 @@ pub const AllErrors = struct { |
| 537 | 540 | }); |
| 538 | 541 | return; |
| 539 | 542 | } |
| 540 | | const source = try module_err_msg.src_loc.file_scope.getSource(module.gpa); |
| 541 | | const byte_offset = try module_err_msg.src_loc.byteOffset(module.gpa); |
| 542 | | const loc = std.zig.findLineColumn(source.bytes, byte_offset); |
| 543 | 543 | const file_path = try module_err_msg.src_loc.file_scope.fullPath(allocator); |
| 544 | 544 | try errors.append(.{ |
| 545 | 545 | .src = .{ |
| 546 | 546 | .src_path = file_path, |
| 547 | 547 | .msg = try allocator.dupe(u8, module_err_msg.msg), |
| 548 | | .byte_offset = byte_offset, |
| 549 | | .line = @intCast(u32, loc.line), |
| 550 | | .column = @intCast(u32, loc.column), |
| 548 | .byte_offset = err_byte_offset, |
| 549 | .line = @intCast(u32, err_loc.line), |
| 550 | .column = @intCast(u32, err_loc.column), |
| 551 | 551 | .notes = notes_buf[0..note_i], |
| 552 | | .source_line = try allocator.dupe(u8, loc.source_line), |
| 552 | .source_line = try allocator.dupe(u8, err_loc.source_line), |
| 553 | 553 | }, |
| 554 | 554 | }); |
| 555 | 555 | } |