zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 45a8c6c1f4efae49effdcecd541572872fa69582 (tree)
parent 6754d1a1826615886b933a7de207d1d97720ae53
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat, 15 Jul 2023 23:07:01 -0700

AstGen: idiomatic use of switch

Diffstat:
Msrc/AstGen.zig | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/AstGen.zig b/src/AstGen.zig @@ -12095,7 +12095,10 @@ const GenZir = struct { return gz.addAsIndex(.{ .tag = .save_err_ret_index, .data = .{ .save_err_ret_index = .{ - .operand = if (cond == .if_of_error_type) cond.if_of_error_type else .none, + .operand = switch (cond) { + .if_of_error_type => |x| x, + else => .none, + }, } }, }); }