| ... | ... | @@ -10,8 +10,8 @@ const log = std.log; |
| 10 | 10 | arena: Allocator, |
| 11 | 11 | wc: *Configuration.Wip, |
| 12 | 12 | module_map: std.array_hash_map.Auto(*std.Build.Module, Configuration.Module.Index) = .empty, |
| 13 | | /// Keyed by package hash. |
| 14 | | package_map: std.array_hash_map.String(Configuration.Package.Index) = .empty, |
| 13 | /// Keyed by package hash. Index + 1 corresponds to `Configuration.packages` index. |
| 14 | package_map: std.array_hash_map.String(void) = .empty, |
| 15 | 15 | /// Index corresponds to `Configuration.steps` index. |
| 16 | 16 | step_map: std.array_hash_map.Auto(*Step, void) = .empty, |
| 17 | 17 | |
| ... | ... | @@ -750,9 +750,9 @@ fn makePackageDep(s: *Serialize, parent_dep_prefix: []const u8, name: []const u8 |
| 750 | 750 | const arena = s.arena; |
| 751 | 751 | const wc = s.wc; |
| 752 | 752 | |
| 753 | | if (s.package_map.get(hash)) |index| return .{ |
| 753 | if (s.package_map.getIndex(hash)) |index| return .{ |
| 754 | 754 | .name = try wc.addString(name), |
| 755 | | .package = index, |
| 755 | .package = @fromBackingInt(@intCast(index + 1)), |
| 756 | 756 | }; |
| 757 | 757 | |
| 758 | 758 | const entry = std.Build.package_map.get(hash) orelse unreachable; |
| ... | ... | @@ -760,7 +760,7 @@ fn makePackageDep(s: *Serialize, parent_dep_prefix: []const u8, name: []const u8 |
| 760 | 760 | const dep_prefix = try arena.print("{s}{s}.", .{ parent_dep_prefix, name }); |
| 761 | 761 | |
| 762 | 762 | const index: Configuration.Package.Index = @fromBackingInt(@intCast(wc.packages.items.len)); |
| 763 | | try s.package_map.put(arena, hash, index); |
| 763 | try s.package_map.put(arena, hash, {}); |
| 764 | 764 | |
| 765 | 765 | try wc.packages.append(wc.gpa, .{ |
| 766 | 766 | .dep_prefix = try wc.addString(dep_prefix), |
| ... | ... | @@ -784,7 +784,7 @@ fn makePackageDep(s: *Serialize, parent_dep_prefix: []const u8, name: []const u8 |
| 784 | 784 | |
| 785 | 785 | fn packageFromHash(s: *Serialize, pkg_hash: []const u8) Configuration.Package.Index { |
| 786 | 786 | if (pkg_hash.len == 0) return .root; |
| 787 | | return s.package_map.get(pkg_hash) orelse std.debug.panic("unrecognized package hash: {q}", .{pkg_hash}); |
| 787 | return @fromBackingInt(@intCast(s.package_map.getIndex(pkg_hash).? + 1)); |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex { |