bugfixes with macro expansions
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 13 Aug 2021 00:24:57 +0000 (19:24 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 13 Aug 2021 00:24:57 +0000 (19:24 -0500)
bin/onyx
core/builtin.onyx
modules/immediate_mode/immediate_renderer.onyx
src/onyxclone.c

index 5d1db354bbb530e15b69912db51f024ff3d0d445..fe2bd2b265a22591bb311e29f9011240bf2a48c2 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 0a33897c07fa7f43d5d285a458583e7b17fd5a48..3d7db024b519cde3fd12d98ad7c713a420f6a3b5 100644 (file)
@@ -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
index 81756646fc66f00fd80e68b5c840770e06944c12..f34242d9660ad640c4d7ee657d964d41440f436a 100644 (file)
@@ -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
index e470b57ddd25208744b43a79d12991b567c7e8c2..3c0b5f2c01b63208eaa84692697d241f909b857f 100644 (file)
@@ -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;
 }