From: Brendan Hansen Date: Fri, 5 Jun 2020 02:19:32 +0000 (-0500) Subject: Bug fixes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=f4e50bda52303d709976f1a08ce3284bab54dba8;p=onyx.git Bug fixes --- diff --git a/Makefile b/Makefile index e3213a83..c1561f1d 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ OBJ_FILES=\ src/onyxparser.o \ src/onyxmsgs.o \ src/onyxutils.o \ + src/onyxwasm.o \ src/onyx.o CC=gcc diff --git a/include/onyxwasm.h b/include/onyxwasm.h index 030dfa67..e7808e75 100644 --- a/include/onyxwasm.h +++ b/include/onyxwasm.h @@ -6,12 +6,12 @@ #include "onyxparser.h" -typedef enum WasmType : char { - WASM_TYPE_INT32 = 0x7F, - WASM_TYPE_INT64 = 0x7E, - WASM_TYPE_FLOAT32 = 0x7D, - WASM_TYPE_FLOAT64 = 0x7C -} WasmType; +typedef char WasmType; + +extern const WasmType WASM_TYPE_INT32; +extern const WasmType WASM_TYPE_INT64; +extern const WasmType WASM_TYPE_FLOAT32; +extern const WasmType WASM_TYPE_FLOAT64; typedef struct WasmFuncType { // NOTE: For now, WASM only allows for 1 return value. diff --git a/onyx b/onyx index 9aa7cdd2..802912fc 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyxwasm.c b/src/onyxwasm.c index 3c1f5fa7..ab9d3497 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -1,5 +1,10 @@ #include "onyxwasm.h" +const WasmType WASM_TYPE_INT32 = 0x7F; +const WasmType WASM_TYPE_INT64 = 0x7E; +const WasmType WASM_TYPE_FLOAT32 = 0x7D; +const WasmType WASM_TYPE_FLOAT64 = 0x7C; + static WasmType onyx_type_to_wasm_type(OnyxTypeInfo* type) { if (type->is_bool) return WASM_TYPE_INT32; if (type->is_int) { @@ -88,6 +93,6 @@ OnyxWasmModule onyx_wasm_generate_module(bh_allocator alloc, OnyxAstNode* progra } void onyx_wasm_module_free(OnyxWasmModule* module) { - bh_arr_free(module.functypes); - bh_arr_free(module.funcs); + bh_arr_free(module->functypes); + bh_arr_free(module->funcs); }