aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-06-21 21:42:30 -0400
committerAndrew Kelley <andrew@ziglang.org>2023-06-22 08:07:02 -0700
commitc60896743d3b0776a44ac63582f51b6e64892528 (patch)
tree916e6ef4aa4647f3907ccf96001ff5350db992f3 /src/value.zig
parent93e54f2354aa1b3de797a7ca5572bfa8c0f733f1 (diff)
downloadzig-c60896743d3b0776a44ac63582f51b6e64892528.tar.gz
zig-c60896743d3b0776a44ac63582f51b6e64892528.zip
Value: handle more legacy tags when writing extern struct to memory
Closes #16130
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/value.zig b/src/value.zig
index 573f0ca7e2..a1cffcb8eb 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -745,7 +745,15 @@ pub const Value = struct {
.Extern => for (ty.structFields(mod).values(), 0..) |field, i| {
const off = @intCast(usize, ty.structFieldOffset(i, mod));
const field_val = switch (val.ip_index) {
- .none => val.castTag(.aggregate).?.data[i],
+ .none => switch (val.tag()) {
+ .bytes => {
+ buffer[off] = val.castTag(.bytes).?.data[i];
+ continue;
+ },
+ .aggregate => val.castTag(.aggregate).?.data[i],
+ .repeated => val.castTag(.repeated).?.data,
+ else => unreachable,
+ },
else => switch (mod.intern_pool.indexToKey(val.toIntern()).aggregate.storage) {
.bytes => |bytes| {
buffer[off] = bytes[i];