config: clone() needs to preserve conditionals of replay steps

Fixes #2791

This goes back to the previous implementation of clone that directly
cloned values rather than using replay steps, because replay steps don't
preserve conditionals on the iterator.

This works.

Another fix will be when we support some sort of conditional syntax and
the replay iterator can yield that information. We have a unit test here
so we can verify that then.
This commit is contained in:
Mitchell Hashimoto
2024-11-23 15:09:39 -08:00
parent 8dd00b4254
commit e031eb17f4
2 changed files with 128 additions and 11 deletions

View File

@@ -61,6 +61,17 @@ pub const Conditional = struct {
value: []const u8,
pub const Op = enum { eq, ne };
pub fn clone(
self: Conditional,
alloc: Allocator,
) Allocator.Error!Conditional {
return .{
.key = self.key,
.op = self.op,
.value = try alloc.dupe(u8, self.value),
};
}
};
test "conditional enum match" {