| ... | @@ -505,6 +505,9 @@ pub const AllErrors = struct { | ... | @@ -505,6 +505,9 @@ pub const AllErrors = struct { |
| 505 | Message.HashContext, | 505 | Message.HashContext, |
| 506 | std.hash_map.default_max_load_percentage, | 506 | std.hash_map.default_max_load_percentage, |
| 507 | ).init(allocator); | 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 | for (module_err_msg.notes) |module_note| { | 512 | for (module_err_msg.notes) |module_note| { |
| 510 | const source = try module_note.src_loc.file_scope.getSource(module.gpa); | 513 | const source = try module_note.src_loc.file_scope.getSource(module.gpa); |
| ... | @@ -519,7 +522,7 @@ pub const AllErrors = struct { | ... | @@ -519,7 +522,7 @@ pub const AllErrors = struct { |
| 519 | .byte_offset = byte_offset, | 522 | .byte_offset = byte_offset, |
| 520 | .line = @intCast(u32, loc.line), | 523 | .line = @intCast(u32, loc.line), |
| 521 | .column = @intCast(u32, loc.column), | 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 | const gop = try seen_notes.getOrPut(note); | 528 | const gop = try seen_notes.getOrPut(note); |
| ... | @@ -537,19 +540,16 @@ pub const AllErrors = struct { | ... | @@ -537,19 +540,16 @@ pub const AllErrors = struct { |
| 537 | }); | 540 | }); |
| 538 | return; | 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 | const file_path = try module_err_msg.src_loc.file_scope.fullPath(allocator); | 543 | const file_path = try module_err_msg.src_loc.file_scope.fullPath(allocator); |
| 544 | try errors.append(.{ | 544 | try errors.append(.{ |
| 545 | .src = .{ | 545 | .src = .{ |
| 546 | .src_path = file_path, | 546 | .src_path = file_path, |
| 547 | .msg = try allocator.dupe(u8, module_err_msg.msg), | 547 | .msg = try allocator.dupe(u8, module_err_msg.msg), |
| 548 | .byte_offset = byte_offset, | 548 | .byte_offset = err_byte_offset, |
| 549 | .line = @intCast(u32, loc.line), | 549 | .line = @intCast(u32, err_loc.line), |
| 550 | .column = @intCast(u32, loc.column), | 550 | .column = @intCast(u32, err_loc.column), |
| 551 | .notes = notes_buf[0..note_i], | 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 | } |