fix: broken conditionals

This commit is contained in:
Brett Broadhurst 2026-03-30 05:44:35 -06:00
parent b231e66b49
commit 97a43f63eb
Failed to generate hash of commit
33 changed files with 358 additions and 313 deletions

View file

@ -33,6 +33,19 @@ pub const Tag = enum {
}
};
pub fn eql(lhs: *Object, rhs: *Object) bool {
if (lhs.tag != rhs.tag) return false;
return switch (lhs.tag) {
.string => blk: {
const lhs_object: *Object.String = @ptrCast(lhs);
const rhs_object: *Object.String = @ptrCast(rhs);
break :blk std.mem.eql(u8, lhs_object.toSlice(), rhs_object.toSlice());
},
.code => |_| false,
.knot => |_| false,
};
}
pub fn destroy(obj: *Object, story: *Story) void {
inline for (comptime std.meta.fields(Tag)) |field| {
const tag = @field(Tag, field.name);