aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-09-23 13:03:03 -0400
committerkcbanner <kcbanner@gmail.com>2023-09-23 13:05:04 -0400
commitf2a24b48e1221a8954ddf16e9070e1470ee13e8d (patch)
tree65443a1d67bb03be28927643462f92568fedbbc0 /src/codegen/spirv.zig
parent2fddd767ba20374e7677003c101e60f470c3804c (diff)
downloadzig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.tar.gz
zig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.zip
sema: rework the comptime representation of comptime unions
When the tag is not known, it's set to `.none`. In this case, the value is either an array of bytes (for extern unions) or an integer (for packed unions).
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 8fb6153938..33a864ea0a 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -838,10 +838,7 @@ pub const DeclGen = struct {
return dg.todo("packed union constants", .{});
}
- const active_field = ty.unionTagFieldIndex(un.tag.toValue(), dg.module) orelse f: {
- assert(union_obj.getLayout(ip) == .Extern);
- break :f mod.unionLargestField(union_obj).index;
- };
+ const active_field = ty.unionTagFieldIndex(un.tag.toValue(), dg.module).?;
const active_field_ty = union_obj.field_types.get(ip)[active_field].toType();
const has_tag = layout.tag_size != 0;