Simplify .protect & unprotect (#16441)

This commit is contained in:
Jarred Sumner
2025-01-16 16:06:32 -08:00
committed by GitHub
parent 348f5e9aeb
commit ec11ea4e73

View File

@@ -4322,12 +4322,12 @@ pub const JSValue = enum(i64) {
}
pub fn protect(this: JSValue) void {
if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return;
if (!this.isCell()) return;
JSC.C.JSValueProtect(JSC.VirtualMachine.get().global, this.asObjectRef());
}
pub fn unprotect(this: JSValue) void {
if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return;
if (!this.isCell()) return;
JSC.C.JSValueUnprotect(JSC.VirtualMachine.get().global, this.asObjectRef());
}