Skip to content

Commit 5f4dd43

Browse files
mookumssjorsdonkers
authored andcommitted
support int enums in jsValueToZig
1 parent e7f16f3 commit 5f4dd43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/js.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,12 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
938938
}
939939
unreachable;
940940
},
941+
.@"enum" => |e| {
942+
switch (@typeInfo(e.tag_type)) {
943+
.int => return std.meta.intToEnum(T, try jsIntToZig(e.tag_type, js_value, self.context)),
944+
else => @compileError(named_function.full_name ++ " has an unsupported enum parameter type: " ++ @typeName(T)),
945+
}
946+
},
941947
else => {},
942948
}
943949

0 commit comments

Comments
 (0)