mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
std.Build: detect and disallow top-level step name clashes
This commit is contained in:
parent
339cae7fd0
commit
1b432072b5
@ -926,7 +926,12 @@ pub fn step(self: *Build, name: []const u8, description: []const u8) *Step {
|
||||
}),
|
||||
.description = self.dupe(description),
|
||||
};
|
||||
self.top_level_steps.put(self.allocator, step_info.step.name, step_info) catch @panic("OOM");
|
||||
const gop = self.top_level_steps.getOrPut(self.allocator, name) catch @panic("OOM");
|
||||
if (gop.found_existing) std.debug.panic("A top-level step with name \"{s}\" already exists", .{name});
|
||||
|
||||
gop.key_ptr.* = step_info.step.name;
|
||||
gop.value_ptr.* = step_info;
|
||||
|
||||
return &step_info.step;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user