Zig 0.14 compatibility

This commit is contained in:
Karl Seguin
2025-03-06 23:00:13 +08:00
committed by Pierre Tachoire
parent 17d3d620ff
commit 21c9dde858
26 changed files with 78 additions and 197 deletions

View File

@@ -454,7 +454,7 @@ pub fn Command(comptime CDP_T: type, comptime Sender: type) type {
pub fn sendResult(self: *Self, result: anytype, opts: SendResultOpts) !void {
return self.sender.sendJSON(.{
.id = self.input.id,
.result = if (comptime @typeInfo(@TypeOf(result)) == .Null) struct {}{} else result,
.result = if (comptime @typeInfo(@TypeOf(result)) == .null) struct {}{} else result,
.sessionId = if (opts.include_session_id) self.input.session_id else null,
});
}
@@ -466,7 +466,7 @@ pub fn Command(comptime CDP_T: type, comptime Sender: type) type {
// Events ALWAYS go to the client. self.sender should not be used
return self.cdp.sendJSON(.{
.method = method,
.params = if (comptime @typeInfo(@TypeOf(p)) == .Null) struct {}{} else p,
.params = if (comptime @typeInfo(@TypeOf(p)) == .null) struct {}{} else p,
.sessionId = opts.session_id,
});
}