From: Brendan Hansen Date: Sun, 29 Aug 2021 21:44:04 +0000 (-0500) Subject: bugfix with deferred statements in macros X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=e81d88507bff0776dcb120444505526117a38c40;p=onyx.git bugfix with deferred statements in macros --- diff --git a/bin/onyx b/bin/onyx index 8fb63e10..15df3245 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/include/onyxastnodes.h b/include/onyxastnodes.h index 759251ad..aaf7be65 100644 --- a/include/onyxastnodes.h +++ b/include/onyxastnodes.h @@ -493,13 +493,14 @@ typedef enum VarArgKind { typedef enum BlockRule { Block_Rule_New_Scope = BH_BIT(1), - Block_Rule_Clear_Defer = BH_BIT(2), - Block_Rule_Override_Return = BH_BIT(3), + Block_Rule_Emit_Instructions = BH_BIT(2), + Block_Rule_Clear_Defer = BH_BIT(3), + Block_Rule_Override_Return = BH_BIT(4), - Block_Rule_Normal = Block_Rule_New_Scope | Block_Rule_Clear_Defer, + Block_Rule_Normal = Block_Rule_New_Scope | Block_Rule_Clear_Defer | Block_Rule_Emit_Instructions, Block_Rule_Macro = Block_Rule_New_Scope, Block_Rule_Code_Block = Block_Rule_New_Scope, - Block_Rule_Do_Block = Block_Rule_New_Scope | Block_Rule_Clear_Defer | Block_Rule_Override_Return, + Block_Rule_Do_Block = Block_Rule_New_Scope | Block_Rule_Clear_Defer | Block_Rule_Override_Return | Block_Rule_Emit_Instructions, } BlockRule; typedef struct Arguments Arguments; diff --git a/modules/ui/components/workspace.onyx b/modules/ui/components/workspace.onyx index eba50d64..4977611f 100644 --- a/modules/ui/components/workspace.onyx +++ b/modules/ui/components/workspace.onyx @@ -30,9 +30,7 @@ workspace_start :: (use r: Rectangle, site := #callsite, state: ^Workspace_State @Hack // This whole situtation is a hack of trying to a pointer to a valid state. if state == null { - state = map.get_ptr(^workspace_states, hash); - - if state == null { + if state = map.get_ptr(^workspace_states, hash); state == null { map.put(^workspace_states, hash, .{}); state = map.get_ptr(^workspace_states, hash); } @@ -51,8 +49,8 @@ workspace_start :: (use r: Rectangle, site := #callsite, state: ^Workspace_State } } - mx, my := get_mouse_position(); - if Rectangle.contains(r, mx, my) { + if mx, my := get_mouse_position(); + Rectangle.contains(r, mx, my) { set_hot_item(hash); } diff --git a/src/onyxwasm.c b/src/onyxwasm.c index 435a7820..beeddfb9 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -282,7 +282,7 @@ EMIT_FUNC(function_body, AstFunction* fd) { EMIT_FUNC(block, AstBlock* block, b32 generate_block_headers) { bh_arr(WasmInstruction) code = *pcode; - generate_block_headers = generate_block_headers && (block->rules & Block_Rule_New_Scope); + generate_block_headers = generate_block_headers && (block->rules & Block_Rule_Emit_Instructions); if (generate_block_headers) { emit_enter_structured_block(mod, &code, (block->rules & Block_Rule_Override_Return)