From 56590218c5054fd5f4076916fd247213a00d5105 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sat, 19 Mar 2022 20:28:28 +0100 Subject: wasm: All union/tuple/array tests passing This implements improvements/fixes to get all the union, tuple, and array behavior tests passing. Previously, we lowered parent pointers for field_ptr and element_ptr incompletely. This has now been improved to recursively lower such pointer. Also a fix was done to `generateSymbol` when checking a container's layout. Previously it was assumed to always be a struct. However, the type can also be a tuple, and therefore panicking. Updating to ask a type's container layout instead allows us to keep a singular branch for both cases. --- src/codegen.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/codegen.zig b/src/codegen.zig index 6d5e140dca..5d61095ff5 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -530,8 +530,7 @@ pub fn generateSymbol( return Result{ .appended = {} }; }, .Struct => { - const struct_obj = typed_value.ty.castTag(.@"struct").?.data; - if (struct_obj.layout == .Packed) { + if (typed_value.ty.containerLayout() == .Packed) { return Result{ .fail = try ErrorMsg.create( bin_file.allocator, -- cgit v1.2.3