aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorJ.C. Moyer <jcmoyer32@gmail.com>2021-06-28 17:31:47 -0400
committerAndrew Kelley <andrew@ziglang.org>2021-07-02 14:08:52 -0400
commitd84b386f6034278c8a9e8c3d2b0975ac541584aa (patch)
tree279ab79fca1601c226a509b3a3a6bbdf0fbf477c /src/Module.zig
parent7140bb64e1aa77f6b6de5c7e4f78d880346c0747 (diff)
downloadzig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.tar.gz
zig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.zip
stage2: print valid filename in error messages
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 439256f320..d37452d99d 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -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 });