stage2: print valid filename in error messages

This commit is contained in:
J.C. Moyer
2021-06-28 17:31:47 -04:00
committed by Andrew Kelley
parent 7140bb64e1
commit d84b386f60
3 changed files with 23 additions and 6 deletions

View File

@@ -1111,6 +1111,11 @@ pub const Scope = struct {
return buf.toOwnedSliceSentinel(0);
}
/// Returns the full path to this file relative to its package.
pub fn fullPath(file: File, ally: *Allocator) ![]u8 {
return file.pkg.root_src_directory.join(ally, &[_][]const u8{file.sub_file_path});
}
pub fn dumpSrc(file: *File, src: LazySrcLoc) void {
const loc = std.zig.findLineColumn(file.source.bytes, src);
std.debug.print("{s}:{d}:{d}\n", .{ file.sub_file_path, loc.line + 1, loc.column + 1 });