diff options
| author | J.C. Moyer <jcmoyer32@gmail.com> | 2021-06-28 17:31:47 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-02 14:08:52 -0400 |
| commit | d84b386f6034278c8a9e8c3d2b0975ac541584aa (patch) | |
| tree | 279ab79fca1601c226a509b3a3a6bbdf0fbf477c /src/Module.zig | |
| parent | 7140bb64e1aa77f6b6de5c7e4f78d880346c0747 (diff) | |
| download | zig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.tar.gz zig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.zip | |
stage2: print valid filename in error messages
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 5 |
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 }); |
