fixed bug with polymorphic functions with 'use' statements
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 14 Dec 2020 20:14:00 +0000 (14:14 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 14 Dec 2020 20:14:00 +0000 (14:14 -0600)
onyx
src/onyxclone.c

diff --git a/onyx b/onyx
index ae7f54b4c3e90be781d5b6df02ccf7b6f4458a8c..8502fe9b80a6dee4c47a2b9e47c7347b08a08252 100755 (executable)
Binary files a/onyx and b/onyx differ
index d1b7ffb77597a2ee04bccc15c9a800a080d47129..e7ebfe2df3822271debd601047b73e39f3d61346 100644 (file)
@@ -16,6 +16,7 @@ static inline b32 should_clone(AstNode* node) {
                case Ast_Kind_Enum_Value:
                case Ast_Kind_Overloaded_Function:
                case Ast_Kind_Polymorphic_Proc:
+               case Ast_Kind_Use_Package:
                        return 0;
 
                default: return 1;
@@ -83,6 +84,7 @@ static inline i32 ast_kind_to_size(AstNode* node) {
         case Ast_Kind_For: return sizeof(AstFor);
         case Ast_Kind_While: return sizeof(AstIfWhile);
         case Ast_Kind_Jump: return sizeof(AstJump);
+        case Ast_Kind_Use: return sizeof(AstUse);
         case Ast_Kind_Defer: return sizeof(AstDefer);
         case Ast_Kind_Switch: return sizeof(AstSwitch);
         case Ast_Kind_Switch_Case: return sizeof(AstSwitchCase);
@@ -348,6 +350,11 @@ AstNode* ast_clone(bh_allocator a, void* n) {
 
                        break;
                }
+
+               case Ast_Kind_Use: {
+                       ((AstUse *) nn)->expr = (AstTyped *) ast_clone(a, ((AstUse *) node)->expr);
+                       break;
+               }
        }
 
        return nn;