From: Brendan Hansen Date: Fri, 13 Aug 2021 00:24:57 +0000 (-0500) Subject: bugfixes with macro expansions X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d94bc7862d7eed279f3cf4277594febbbeebbb1b;p=onyx.git bugfixes with macro expansions --- diff --git a/bin/onyx b/bin/onyx index 5d1db354..fe2bd2b2 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/core/builtin.onyx b/core/builtin.onyx index 0a33897c..3d7db024 100644 --- a/core/builtin.onyx +++ b/core/builtin.onyx @@ -190,4 +190,4 @@ any :: struct { // Represents a code block. Not constructable outside of using a '#code' directive. -Code :: struct {} \ No newline at end of file +Code :: struct {_:i32;} \ No newline at end of file diff --git a/modules/immediate_mode/immediate_renderer.onyx b/modules/immediate_mode/immediate_renderer.onyx index 81756646..f34242d9 100644 --- a/modules/immediate_mode/immediate_renderer.onyx +++ b/modules/immediate_mode/immediate_renderer.onyx @@ -521,7 +521,9 @@ apply_transform :: (transform: Transform) do global_renderer->apply_transform(tr save_matrix :: macro () { + // Not counting a specific name for this import I :: package immediate_mode + I.push_matrix(); defer I.pop_matrix(); } \ No newline at end of file diff --git a/src/onyxclone.c b/src/onyxclone.c index e470b57d..3c0b5f2c 100644 --- a/src/onyxclone.c +++ b/src/onyxclone.c @@ -126,6 +126,9 @@ AstNode* ast_clone(bh_allocator a, void* n) { if (node == NULL) return NULL; if (!should_clone(node)) return node; + static int clone_depth = 0; + clone_depth++; + i32 node_size = ast_kind_to_size(node); // bh_printf("Cloning %s with size %d\n", onyx_ast_node_kind_string(node->kind), node_size); @@ -363,6 +366,11 @@ AstNode* ast_clone(bh_allocator a, void* n) { break; case Ast_Kind_Function: { + if (clone_depth > 1) { + clone_depth--; + return node; + } + AstFunction* df = (AstFunction *) nn; AstFunction* sf = (AstFunction *) node; @@ -442,6 +450,7 @@ AstNode* ast_clone(bh_allocator a, void* n) { } } + clone_depth--; return nn; }