diff --git a/src/lib.zig b/src/lib.zig index bcfe0d478..a5056f960 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -839,7 +839,7 @@ export fn clUnwrapChoice(vm: *cy.VM, choice: cy.Value, name: c.Str) cy.Value { // To enable logging for tests: // c.setVerbose(true); // c.setLog(printLogger); -pub fn printLogger(str: c.Str) callconv(.C) void { +fn printLogger(str: c.Str) callconv(.C) void { std.debug.print("{s}\n", .{ c.fromStr(str) }); } diff --git a/src/web.zig b/src/web.zig index 38971c440..2439f96ee 100644 --- a/src/web.zig +++ b/src/web.zig @@ -94,17 +94,18 @@ export fn clWebGetFuture(vm: *cy.VM, id: u32) cy.Value { return futurev; } -export fn clWebNewFuture(vm: *cy.VM) u32 { - const ctx = vm.getData(*WebContext, "web"); +export fn clWebNewFuture(ivm: *cy.VM) u32 { + const vm: *C.ZVM = @ptrCast(ivm); + const ctx = ivm.getData(*WebContext, "web"); - const any_t = C.newType(@ptrCast(vm), cy.types.BuiltinTypes.Any); - defer C.release(@ptrCast(vm), any_t); + const any_t = vm.newType(cy.types.BuiltinTypes.Any); + defer vm.release(any_t); var FutureAnyT: cy.TypeId = undefined; - std.debug.assert(C.expandTemplateType(vm.sema.future_tmpl.head.toC(), &any_t, 1, &FutureAnyT)); - const future = vm.allocFuture(FutureAnyT) catch @panic("error"); + std.debug.assert(vm.expandTemplateType(ivm.sema.future_tmpl.head.toC(), &.{any_t}, &FutureAnyT)); + const future = ivm.allocFuture(FutureAnyT) catch @panic("error"); const id = ctx.next_id; - ctx.futures.put(vm.alloc, id, future) catch @panic("error"); + ctx.futures.put(ivm.alloc, id, future) catch @panic("error"); ctx.next_id += 1; return id; }