From: Brendan Hansen Date: Mon, 31 Jan 2022 03:48:27 +0000 (-0600) Subject: added type_info.enum_values X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=3cf313f5b83c0a875f6e7730f86b246f7074a143;p=onyx.git added type_info.enum_values --- diff --git a/core/type_info/helper.onyx b/core/type_info/helper.onyx index 8dd29e15..43ea2993 100644 --- a/core/type_info/helper.onyx +++ b/core/type_info/helper.onyx @@ -205,3 +205,10 @@ enum_value :: ($E: type_expr, name: str) -> E { return ~~0; } + +enum_values :: (E: type_expr) -> [] Type_Info_Enum.Member { + info := cast(^Type_Info_Enum) get_type_info(E); + if info.kind != .Enum do return .[]; + + return info.members; +} \ No newline at end of file