aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-09-09 09:55:09 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-12-14 14:26:02 -0700
commita62c8d36d530dc78f88dc0f41ce3f244c3c273bd (patch)
treefd92869eefe7bd99af8cf3fbcad1533bb5797ec8 /src/Module.zig
parentf65cdef7c8bfe7a47e1c30cfa3903ca2d53495cf (diff)
downloadzig-a62c8d36d530dc78f88dc0f41ce3f244c3c273bd.tar.gz
zig-a62c8d36d530dc78f88dc0f41ce3f244c3c273bd.zip
std.fs.Dir.statFile rework
* revert changes to Module because the error set is consistent across operating systems. * remove duplicated Stat.fromSystem code and use a less redundant name. * make fs.Dir.statFile follow symlinks, and avoid pointless control flow through the posix layer.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/Module.zig b/src/Module.zig
index d4af06f896..83294f3068 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -4137,19 +4137,14 @@ pub fn populateBuiltinFile(mod: *Module) !void {
};
}
} else |err| switch (err) {
+ error.BadPathName => unreachable, // it's always "builtin.zig"
error.NameTooLong => unreachable, // it's always "builtin.zig"
+ error.PipeBusy => unreachable, // it's not a pipe
+ error.WouldBlock => unreachable, // not asking for non-blocking I/O
+
error.FileNotFound => try writeBuiltinFile(file, builtin_pkg),
- else => |e| {
- if (builtin.os.tag == .windows) {
- switch (e) {
- error.BadPathName => unreachable, // it's always "builtin.zig"
- error.PipeBusy => unreachable, // it's not a pipe
- error.WouldBlock => unreachable, // not asking for non-blocking I/O
- else => return e,
- }
- }
- return e;
- },
+
+ else => |e| return e,
}
file.tree = try std.zig.parse(gpa, file.source);