Update to latest zig
This commit is contained in:
parent
a18a627f98
commit
c0a10ee49d
@ -411,7 +411,7 @@ pub const Registry = struct {
|
||||
std.debug.assert(@typeInfo(T) != .Pointer);
|
||||
|
||||
return if (self.contexts.get(utils.typeId(T))) |ptr|
|
||||
return if (ptr.value > 0) @intToPtr(*T, ptr.value) else null
|
||||
return if (ptr > 0) @intToPtr(*T, ptr) else null
|
||||
else
|
||||
null;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ pub const TypeStore = struct {
|
||||
}
|
||||
|
||||
pub fn get(self: *TypeStore, comptime T: type) *T {
|
||||
if (self.map.getValue(utils.typeId(T))) |bytes| {
|
||||
if (self.map.get(utils.typeId(T))) |bytes| {
|
||||
return @ptrCast(*T, @alignCast(@alignOf(T), bytes));
|
||||
}
|
||||
unreachable;
|
||||
@ -48,7 +48,7 @@ pub const TypeStore = struct {
|
||||
}
|
||||
|
||||
pub fn remove(self: *TypeStore, comptime T: type) void {
|
||||
if (self.map.getValue(utils.typeId(T))) |bytes| {
|
||||
if (self.map.get(utils.typeId(T))) |bytes| {
|
||||
self.allocator.free(bytes);
|
||||
_ = self.map.remove(utils.typeId(T));
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ pub const Assets = struct {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: Assets) void {
|
||||
pub fn deinit(self: *Assets) void {
|
||||
var it = self.caches.iterator();
|
||||
while (it.next()) |ptr| {
|
||||
// HACK: we dont know the Type here but we need to call deinit
|
||||
@ -24,7 +24,7 @@ pub const Assets = struct {
|
||||
}
|
||||
|
||||
pub fn get(self: *Assets, comptime AssetT: type) *Cache(AssetT) {
|
||||
if (self.caches.getValue(utils.typeId(AssetT))) |tid| {
|
||||
if (self.caches.get(utils.typeId(AssetT))) |tid| {
|
||||
return @intToPtr(*Cache(AssetT), tid);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ pub fn Cache(comptime T: type) type {
|
||||
}
|
||||
|
||||
pub fn load(self: *@This(), id: u32, comptime loader: anytype) @typeInfo(@TypeOf(@field(loader, "load"))).BoundFn.return_type.? {
|
||||
if (self.resources.getValue(id)) |resource| {
|
||||
if (self.resources.get(id)) |resource| {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ pub fn Cache(comptime T: type) type {
|
||||
@call(.{ .modifier = .always_inline }, @field(kv.value, "deinit"), .{});
|
||||
}
|
||||
}
|
||||
self.resources.clear();
|
||||
self.resources.clearAndFree();
|
||||
}
|
||||
|
||||
pub fn size(self: @This()) usize {
|
||||
return self.resources.size;
|
||||
return self.resources.items().len;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub const Dispatcher = struct {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: Dispatcher) void {
|
||||
pub fn deinit(self: *Dispatcher) void {
|
||||
var it = self.signals.iterator();
|
||||
while (it.next()) |ptr| {
|
||||
// HACK: we dont know the Type here but we need to call deinit
|
||||
@ -27,8 +27,8 @@ pub const Dispatcher = struct {
|
||||
|
||||
fn assure(self: *Dispatcher, comptime T: type) *Signal(T) {
|
||||
var type_id = utils.typeId(T);
|
||||
if (self.signals.get(type_id)) |kv| {
|
||||
return @intToPtr(*Signal(T), kv.value);
|
||||
if (self.signals.get(type_id)) |value| {
|
||||
return @intToPtr(*Signal(T), value);
|
||||
}
|
||||
|
||||
var signal = Signal(T).create(self.allocator);
|
||||
|
Loading…
x
Reference in New Issue
Block a user