From: Brendan Hansen Date: Sat, 8 Aug 2020 16:17:32 +0000 (-0500) Subject: small bugfix with struct typing X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=f6be11b936fd1c43850eeba3ade5519e9cc6f605;p=onyx.git small bugfix with struct typing --- 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; }