aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/CheckObject.zig
diff options
context:
space:
mode:
authorwooster0 <wooster0@proton.me>2025-05-11 17:38:16 +0900
committerAlex Rønne Petersen <alex@alexrp.com>2025-05-13 07:28:41 +0200
commita365971a337116dd23df2b1bc86468d54885b4b2 (patch)
tree070dfe739796151d4d1256a3cedd83989609be42 /lib/std/Build/Step/CheckObject.zig
parenta3693aae3a9417c4298788af570762945b21ccba (diff)
downloadzig-a365971a337116dd23df2b1bc86468d54885b4b2.tar.gz
zig-a365971a337116dd23df2b1bc86468d54885b4b2.zip
std.meta.intToEnum -> std.enums.fromInt
Also use an optional as the return type instead of an error code.
Diffstat (limited to 'lib/std/Build/Step/CheckObject.zig')
-rw-r--r--lib/std/Build/Step/CheckObject.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig
index 5fee8c730b..c2ff85c6f1 100644
--- a/lib/std/Build/Step/CheckObject.zig
+++ b/lib/std/Build/Step/CheckObject.zig
@@ -2445,7 +2445,7 @@ const WasmDumper = struct {
switch (check.kind) {
.headers => {
while (reader.readByte()) |current_byte| {
- const section = std.meta.intToEnum(std.wasm.Section, current_byte) catch {
+ const section = std.enums.fromInt(std.wasm.Section, current_byte) orelse {
return step.fail("Found invalid section id '{d}'", .{current_byte});
};
@@ -2551,7 +2551,7 @@ const WasmDumper = struct {
const name = data[fbs.pos..][0..name_len];
fbs.pos += name_len;
- const kind = std.meta.intToEnum(std.wasm.ExternalKind, try reader.readByte()) catch {
+ const kind = std.enums.fromInt(std.wasm.ExternalKind, try reader.readByte()) orelse {
return step.fail("invalid import kind", .{});
};
@@ -2613,7 +2613,7 @@ const WasmDumper = struct {
const name = data[fbs.pos..][0..name_len];
fbs.pos += name_len;
const kind_byte = try std.leb.readUleb128(u8, reader);
- const kind = std.meta.intToEnum(std.wasm.ExternalKind, kind_byte) catch {
+ const kind = std.enums.fromInt(std.wasm.ExternalKind, kind_byte) orelse {
return step.fail("invalid export kind value '{d}'", .{kind_byte});
};
const index = try std.leb.readUleb128(u32, reader);
@@ -2664,7 +2664,7 @@ const WasmDumper = struct {
fn parseDumpType(step: *Step, comptime E: type, reader: anytype, writer: anytype) !E {
const byte = try reader.readByte();
- const tag = std.meta.intToEnum(E, byte) catch {
+ const tag = std.enums.fromInt(E, byte) orelse {
return step.fail("invalid wasm type value '{d}'", .{byte});
};
try writer.print("type {s}\n", .{@tagName(tag)});
@@ -2683,7 +2683,7 @@ const WasmDumper = struct {
fn parseDumpInit(step: *Step, reader: anytype, writer: anytype) !void {
const byte = try reader.readByte();
- const opcode = std.meta.intToEnum(std.wasm.Opcode, byte) catch {
+ const opcode = std.enums.fromInt(std.wasm.Opcode, byte) orelse {
return step.fail("invalid wasm opcode '{d}'", .{byte});
};
switch (opcode) {