diff options
| author | Vexu <git@vexu.eu> | 2020-02-24 23:03:30 +0200 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-02-24 23:09:01 +0200 |
| commit | 45da72c5b64069b7d5238465130a50f96678a148 (patch) | |
| tree | 136529c703d9cb9e52f2df2354dc0bb03fcbc482 /lib/std/meta.zig | |
| parent | 1d06c82c3bc44e808a3d7b4fe07e5c9fc492e8c3 (diff) | |
| download | zig-45da72c5b64069b7d5238465130a50f96678a148.tar.gz zig-45da72c5b64069b7d5238465130a50f96678a148.zip | |
remove usages of `@typeId`, `@memberCount`, `@memberName` and `@memberType`
Diffstat (limited to 'lib/std/meta.zig')
| -rw-r--r-- | lib/std/meta.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 300bca3d0e..e302a80ef1 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -536,9 +536,8 @@ test "intToEnum with error return" { pub const IntToEnumError = error{InvalidEnumTag}; pub fn intToEnum(comptime Tag: type, tag_int: var) IntToEnumError!Tag { - comptime var i = 0; - inline while (i != @memberCount(Tag)) : (i += 1) { - const this_tag_value = @field(Tag, @memberName(Tag, i)); + inline for (@typeInfo(Tag).Enum.fields) |f| { + const this_tag_value = @field(Tag, f.name); if (tag_int == @enumToInt(this_tag_value)) { return this_tag_value; } |
