update compiler

This commit is contained in:
Andrew Kelley
2025-07-15 23:38:18 -07:00
parent b3ee5a6c30
commit c4776d66af
9 changed files with 91 additions and 64 deletions
+2 -9
View File
@@ -530,18 +530,11 @@ test isUnderscore {
try std.testing.expect(!isUnderscore("\\x5f"));
}
pub fn readSourceFileToEndAlloc(gpa: Allocator, input: std.fs.File, size_hint: usize) ![:0]u8 {
pub fn readSourceFileToEndAlloc(gpa: Allocator, file_reader: *std.fs.File.Reader) ![:0]u8 {
var buffer: std.ArrayListAlignedUnmanaged(u8, .@"2") = .empty;
defer buffer.deinit(gpa);
try buffer.ensureUnusedCapacity(gpa, size_hint);
input.readIntoArrayList(gpa, .limited(max_src_size), .@"2", &buffer) catch |err| switch (err) {
error.ConnectionResetByPeer => unreachable,
error.ConnectionTimedOut => unreachable,
error.NotOpenForReading => unreachable,
else => |e| return e,
};
try file_reader.interface.appendRemaining(gpa, .@"2", &buffer, .limited(max_src_size));
// Detect unsupported file types with their Byte Order Mark
const unsupported_boms = [_][]const u8{