fix dependencies.zig generation with no dependencies

This commit is contained in:
Andrew Kelley 2023-10-08 17:26:02 -07:00
parent 8f20ce74f4
commit 7bae6d9064

View File

@ -116,8 +116,11 @@ pub const JobQueue = struct {
pub fn createDependenciesSource(jq: *JobQueue, buf: *std.ArrayList(u8)) Allocator.Error!void {
const keys = jq.table.keys();
if (keys.len == 0)
assert(keys.len != 0); // caller should have added the first one
if (keys.len == 1) {
// This is the first one. It must have no dependencies.
return createEmptyDependenciesSource(buf);
}
try buf.appendSlice("pub const packages = struct {\n");