small bugfixes and documentation
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 2 Jun 2021 22:13:20 +0000 (17:13 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 2 Jun 2021 22:13:20 +0000 (17:13 -0500)
src/onyx.c
src/onyxchecker.c
src/onyxsymres.c

index 767f2199fcc8b4140dbfca11c2b80fd9e26407b4..0a7b1d50c85438feaaaa74482340c7094cc7dc34 100644 (file)
@@ -267,7 +267,7 @@ static b32 process_entity(Entity* ent) {
     if (context.options->verbose_output == 3) {
         if (ent->expr && ent->expr->token)
             snprintf(verbose_output_buffer, 511,
-                    "%15s | %20s (%d, %d) | %s:%i:%i \n",
+                    "%20s | %24s (%d, %d) | %s:%i:%i \n",
                    entity_state_strings[ent->state],
                    entity_type_strings[ent->type],
                    (u32) ent->macro_attempts,
@@ -278,7 +278,7 @@ static b32 process_entity(Entity* ent) {
         
         else if (ent->expr)
             snprintf(verbose_output_buffer, 511,
-                    "%15s | %20s (%d, %d) \n",
+                    "%20s | %24s (%d, %d) \n",
                    entity_state_strings[ent->state],
                    entity_type_strings[ent->type],
                    (u32) ent->macro_attempts,
@@ -409,6 +409,12 @@ static i32 onyx_compile() {
         // check if it is the same entity. If it is, it means all other entities that were processed
         // between the two occurences didn't make any progress either, and there must be a cycle.
         //                                                              - brendanfh 2021/02/06
+        //
+        // Because of the recent changes to the compiler architecture (again), this condition
+        // does not always hold anymore. There can be nodes that get scheduled multiple times
+        // before the "key" node that will unblock the progress. This means a more sophisticated
+        // cycle detection algorithm must be used.
+        //
         static Entity* first_no_change = NULL;
         if (!changed) {
             if (!first_no_change) first_no_change = ent;
index 49801d8ae5cbe8d3b123bc29a63a20ede9503e1c..28f15d85b9e9d8c93044063953265d64340a7b5b 100644 (file)
@@ -1628,7 +1628,9 @@ CheckStatus check_overloaded_function(AstOverloadedFunction* func) {
             return Check_Error;
         }
 
-        if ((*node)->entity && (*node)->entity->state <= Entity_State_Check_Types) {
+        if ((*node)->entity &&
+            (*node)->entity->type != Entity_Type_Overloaded_Function &&
+            (*node)->entity->state <= Entity_State_Check_Types) {
             done = 0;
         }
     }
index 4ee4b584e634a5402f7f0fec0271e9664b2c763b..97d4a15399b9a0f340dd59ed1cd6e781f77b90eb 100644 (file)
@@ -1117,8 +1117,8 @@ void symres_entity(Entity* ent) {
     }
 
     report_unresolved_symbols = (context.entities.type_count[Entity_Type_Static_If] == 0 &&
-                                 context.entities.type_count[Entity_Type_Use_Package] == 0)
-                                || context.cycle_detected;
+                                 context.entities.type_count[Entity_Type_Use_Package] == 0);
+                                // || context.cycle_detected;
 
     SymresStatus ss = Symres_Success;
     EntityState next_state = Entity_State_Check_Types;