diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-03-19 20:28:28 +0100 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-03-19 20:56:04 +0100 |
| commit | 56590218c5054fd5f4076916fd247213a00d5105 (patch) | |
| tree | ecdcceca46d3685106500575fed5273f2e4067c6 /src/codegen.zig | |
| parent | 2041176c5e7d2b469c2fe0168e142fe8f322b9bc (diff) | |
| download | zig-56590218c5054fd5f4076916fd247213a00d5105.tar.gz zig-56590218c5054fd5f4076916fd247213a00d5105.zip | |
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.
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 3 |
1 files changed, 1 insertions, 2 deletions
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, |
