Update JSRef.zig

This commit is contained in:
Jarred Sumner
2025-09-10 21:56:52 -07:00
parent bded3385c1
commit aa9c3c1a3e

View File

@@ -64,6 +64,21 @@ pub const JSRef = union(enum) {
}
}
pub fn downgrade(this: *@This()) void {
switch (this.*) {
.weak => {},
.strong => {
if (this.strong.trySwap()) |strong| {
bun.debugAssert(strong != .zero);
this.* = .{ .weak = strong };
}
},
.finalized => {},
}
}
pub const finalize = deinit;
pub fn deinit(this: *@This()) void {
switch (this.*) {
.weak => {