mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 21:01:52 +00:00
Update JSRef.zig
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user