Skip to content

Commit 5b69b95

Browse files
authored
fix: builtin Type's enums are renamed (#65)
1 parent 6795d19 commit 5b69b95

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/event.zig

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ pub const Event = struct {
139139
pub fn returnValue(e: Event, val: anytype) void {
140140
const T = @TypeOf(val);
141141
const type_info = @typeInfo(T);
142+
143+
const is_dev = builtin.zig_version.minor > 13;
144+
142145
switch (type_info) {
143-
.Pointer => |pointer| {
146+
if (is_dev) .pointer else .Pointer => |pointer| {
144147
if (pointer.size == .Slice and
145148
pointer.child == u8 and
146149
(if (pointer.sentinel) |sentinel| @as(*u8, @ptrCast(sentinel)).* == 0 else false))
@@ -151,7 +154,7 @@ pub const Event = struct {
151154
@compileError(err_msg);
152155
}
153156
},
154-
.Int => |int| {
157+
if (is_dev) .int else .Int => |int| {
155158
const bits = int.bits;
156159
const is_signed = int.signedness == .signed;
157160
if (is_signed and bits <= 64) {
@@ -163,12 +166,8 @@ pub const Event = struct {
163166
@compileError(err_msg);
164167
}
165168
},
166-
.Bool => {
167-
e.returnBool(val);
168-
},
169-
.Float => {
170-
e.returnFloat(val);
171-
},
169+
if (is_dev) .bool else .Bool => e.returnBool(val),
170+
if (is_dev) .float else .Float => e.returnFloat(val),
172171
else => {
173172
const err_msg = comptimePrint("val's type ({}), only support int, bool, string([]const u8)!", .{T});
174173
@compileError(err_msg);

0 commit comments

Comments
 (0)