Skip to content

Commit

Permalink
try fix master
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Aug 30, 2024
1 parent 6795d19 commit fa93a1a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/event.zig
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ pub const Event = struct {
pub fn returnValue(e: Event, val: anytype) void {
const T = @TypeOf(val);
const type_info = @typeInfo(T);

const is_dev = builtin.zig_version.minor > 13;

switch (type_info) {
.Pointer => |pointer| {
if (is_dev) .pointer else .Pointer => |pointer| {
if (pointer.size == .Slice and
pointer.child == u8 and
(if (pointer.sentinel) |sentinel| @as(*u8, @ptrCast(sentinel)).* == 0 else false))
Expand All @@ -151,7 +154,7 @@ pub const Event = struct {
@compileError(err_msg);
}
},
.Int => |int| {
if (is_dev) .int else .Int => |int| {
const bits = int.bits;
const is_signed = int.signedness == .signed;
if (is_signed and bits <= 64) {
Expand All @@ -163,12 +166,8 @@ pub const Event = struct {
@compileError(err_msg);
}
},
.Bool => {
e.returnBool(val);
},
.Float => {
e.returnFloat(val);
},
if (is_dev) .bool else .Bool => e.returnBool(val),
if (is_dev) .float else .Float => e.returnFloat(val),
else => {
const err_msg = comptimePrint("val's type ({}), only support int, bool, string([]const u8)!", .{T});
@compileError(err_msg);
Expand Down

0 comments on commit fa93a1a

Please sign in to comment.