From: Brendan Hansen Date: Sat, 15 Aug 2020 16:22:12 +0000 (-0500) Subject: small bugfix when assigning to memory reservations X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=5d4d319e77c5949e0f6b8aca7d4f2b87eebc26f1;p=onyx.git small bugfix when assigning to memory reservations --- diff --git a/include/onyxastnodes.h b/include/onyxastnodes.h index c9b0e146..fa2af347 100644 --- a/include/onyxastnodes.h +++ b/include/onyxastnodes.h @@ -507,7 +507,8 @@ static inline b32 is_lval(AstNode* node) { || (node->kind == Ast_Kind_Global) || (node->kind == Ast_Kind_Dereference) || (node->kind == Ast_Kind_Array_Access) - || (node->kind == Ast_Kind_Field_Access); + || (node->kind == Ast_Kind_Field_Access) + || (node->kind == Ast_Kind_Memres); } static inline b32 binop_is_assignment(AstBinaryOp* binop) { diff --git a/onyx b/onyx index f1d47654..c33f8752 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyxwasm.c b/src/onyxwasm.c index c6f7529d..c9ffe689 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -507,6 +507,14 @@ COMPILE_FUNC(assignment, AstBinaryOp* assign) { compile_expression(mod, &code, assign->right); compile_store_instruction(mod, &code, field->type, offset); + + } else if (lval->kind == Ast_Kind_Memres) { + AstMemRes* memres = (AstMemRes *) lval; + + compile_memory_reservation_location(mod, &code, memres); + compile_expression(mod, &code, assign->right); + compile_store_instruction(mod, &code, memres->type, 0); + } else { assert(("Invalid lval", 0)); }