aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorjacobly0 <jacobly0@users.noreply.github.com>2022-10-12 05:40:59 -0400
committerGitHub <noreply@github.com>2022-10-12 12:40:59 +0300
commit562ac8be48e4a08358da73e556e331e3618f8b4b (patch)
tree3495e59a81924c3a8ff12b8948fe069f01f104cc /src/arch/wasm/CodeGen.zig
parentb47e54ed3f6e5d93fff8a2327c88c903cc0a194c (diff)
downloadzig-562ac8be48e4a08358da73e556e331e3618f8b4b.tar.gz
zig-562ac8be48e4a08358da73e556e331e3618f8b4b.zip
codegen: add support for lowering .field_ptr on a slice
Closes #13068
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index a72ae6a423..f27957d3f5 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2289,6 +2289,14 @@ fn lowerParentPtr(self: *Self, ptr_val: Value, ptr_child_ty: Type) InnerError!WV
const offset = @intCast(u32, std.mem.alignForwardGeneric(u64, layout.tag_size, layout.tag_align));
break :blk offset;
},
+ .Pointer => switch (parent_ty.ptrSize()) {
+ .Slice => switch (field_ptr.field_index) {
+ 0 => 0,
+ 1 => self.ptrSize(),
+ else => unreachable,
+ },
+ else => unreachable,
+ },
else => unreachable,
};