fix: broken conditionals
This commit is contained in:
parent
b231e66b49
commit
97a43f63eb
33 changed files with 358 additions and 313 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue