authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-10-08 21:21:15+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-10-15 14:00:30+02:00
log10b8171466f6a2572cea0b8e70eba33be0020ac2
treed7e129c7128810eb21cb61482297482cf2cc84ba
parent3ca1f888980641c9d9aff02100f277833b988413
signaturebadge-check Signed by SSH key SHA256:CQ99aPxq+RueiL9u7z0FEki5Fm7V6T8q4PrEGmINrA4

spirv: handle errors in switch


1 files changed, 2 insertions(+), 0 deletions(-)

src/codegen/spirv.zig+2
...@@ -3924,6 +3924,7 @@ const DeclGen = struct {...@@ -3924,6 +3924,7 @@ const DeclGen = struct {
3924 };3924 };
3925 break :blk if (backing_bits <= 32) @as(u32, 1) else 2;3925 break :blk if (backing_bits <= 32) @as(u32, 1) else 2;
3926 },3926 },
3927 .ErrorSet => 1,
3927 else => return self.todo("implement switch for type {s}", .{@tagName(cond_ty.zigTypeTag(mod))}), // TODO: Figure out which types apply here, and work around them as we can only do integers.3928 else => return self.todo("implement switch for type {s}", .{@tagName(cond_ty.zigTypeTag(mod))}), // TODO: Figure out which types apply here, and work around them as we can only do integers.
3928 };3929 };
39293930
...@@ -3977,6 +3978,7 @@ const DeclGen = struct {...@@ -3977,6 +3978,7 @@ const DeclGen = struct {
3977 // TODO: figure out of cond_ty is correct (something with enum literals)3978 // TODO: figure out of cond_ty is correct (something with enum literals)
3978 break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants3979 break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants
3979 },3980 },
3981 .ErrorSet => value.getErrorInt(mod),
3980 else => unreachable,3982 else => unreachable,
3981 };3983 };
3982 const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) {3984 const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) {