From f6be11b936fd1c43850eeba3ade5519e9cc6f605 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Sat, 8 Aug 2020 11:17:32 -0500 Subject: [PATCH] small bugfix with struct typing --- src/onyxwasm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/onyxwasm.c b/src/onyxwasm.c index 177d1f9d..caff5d93 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -202,7 +202,7 @@ static const char* wi_string(WasmInstructionType wit) { static WasmType onyx_type_to_wasm_type(Type* type) { if (type->kind == Type_Kind_Struct) { - DEBUG_HERE; + return WASM_TYPE_VOID; } if (type->kind == Type_Kind_Enum) { @@ -452,6 +452,15 @@ COMPILE_FUNC(store_instruction, Type* type, u32 alignment, u32 offset) { COMPILE_FUNC(load_instruction, Type* type, u32 offset) { bh_arr(WasmInstruction) code = *pcode; + if (type->kind == Type_Kind_Array) { + if (offset != 0) { + WID(WI_I32_CONST, offset); + WI(WI_I32_ADD); + } + + return; + } + if (type->kind == Type_Kind_Enum) { type = type->Enum.backing; } -- 2.25.1