Skip to content

Commit aa4852f

Browse files
committed
Fix issue with using . on a ptr and loop for semantic just in case it does not succseed
1 parent 64a0d8a commit aa4852f

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

semantic/metac_semantic.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
875875
paramVar->VarIdentifier);
876876
f->Parameters[i].VarIdentifier = semaId;
877877
*/
878-
f->Parameters[i].VarIdentifier = paramVar.VarIdentifier;
878+
f->Parameters[i].VarIdentifier = paramVar->VarIdentifier;
879879

880880
f->Parameters[i].VarFlags |= variable_is_parameter;
881881
if (METAC_NODE(paramVar->VarInitExpr) != emptyNode)
@@ -888,10 +888,25 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
888888
{
889889
METAC_NODE(f->Parameters[i].VarInitExpr) = emptyNode;
890890
}
891-
metac_type_index_t idx;
892-
idx = f->Parameters[i].TypeIndex =
893-
MetaCSemantic_doTypeSemantic(self,
894-
currentParam->Parameter->VarType);
891+
for (;;)
892+
{
893+
static const metac_type_index_t unresolvedTypeIndex = {0};
894+
metac_type_index_t idx;
895+
idx = f->Parameters[i].TypeIndex =
896+
MetaCSemantic_doTypeSemantic(self,
897+
currentParam->Parameter->VarType);
898+
if (idx.v != unresolvedTypeIndex.v)
899+
{
900+
break;
901+
}
902+
else
903+
{
904+
#ifndef NO_FIBERS
905+
YIELD("Waiting for type semantic on function parameter");
906+
#else
907+
#endif
908+
}
909+
}
895910
uint32_t hash = f->Parameters[i].TypeIndex.v;
896911
hash = CRC32C_VALUE(hash, i);
897912
f->Parameters[i].Hash = hash;
@@ -1115,7 +1130,7 @@ const char* doDeclSemantic_PrintFunction(task_t* task)
11151130
#endif
11161131

11171132
metac_sema_decl_t* MetaCSemantic_declSemantic(metac_sema_state_t* self,
1118-
metac_decl_t* decl)
1133+
metac_decl_t* decl)
11191134
{
11201135
metac_sema_decl_t* result = cast(metac_sema_decl_t*)(intptr_t)0xFEFEFEFE;
11211136
metac_identifier_ptr_t declId = {0};
@@ -1266,12 +1281,12 @@ metac_sema_decl_t* MetaCSemantic_doDeclSemantic_(metac_sema_state_t* self,
12661281
(*(MetaCSemantic_doDeclSemantic_task_context_t*)declTask.Context) =
12671282
CtxValue;
12681283
MetaCSemantic_doDeclSemantic_task_context_t* CtxValuePtr = &CtxValue;
1269-
printf("We should yield now\n");
1284+
xprintf("We should yield now\n");
12701285
declTask.Continuation = currentTask;
12711286
TaskQueue_Push(q, &declTask);
12721287
U32(currentTask->TaskFlags) |= Task_Waiting;
12731288

1274-
YIELD(waiting_for_declSemantic);
1289+
YIELD("waiting for declSemantic");
12751290

12761291
printf("We are back\n");
12771292
result = CtxValuePtr->Result;

0 commit comments

Comments
 (0)