Handle 0 in isCell

This commit is contained in:
Jarred Sumner
2023-01-09 02:28:14 -08:00
parent cb75b4799f
commit f0475e89c5

View File

@@ -3139,7 +3139,10 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub inline fn isCell(this: JSValue) bool {
return (@bitCast(u64, @enumToInt(this)) & FFI.NotCellMask) == 0;
return switch (this) {
.zero, .undefined, .null, .true, .false => false,
else => (@bitCast(u64, @enumToInt(this)) & FFI.NotCellMask) == 0,
};
}
pub fn asCell(this: JSValue) *JSCell {