@@ -63,16 +63,18 @@ static inline bool isBasicType(metac_type_kind_t typeKind)
6363bool IsUnknownType (metac_sema_state_t * self ,
6464 metac_type_index_t typeIndex )
6565{
66+ bool result = false;
67+
6668 if (TYPE_INDEX_KIND (typeIndex ) == type_index_unknown )
6769 {
68- return true;
70+ result = true;
6971 }
7072 if (TYPE_INDEX_KIND (typeIndex ) == type_index_array )
7173 {
72- return IsUnknownType (self , self -> ArrayTypeTable .Slots [TYPE_INDEX_INDEX (typeIndex )].TypeIndex );
74+ result = IsUnknownType (self , self -> ArrayTypeTable .Slots [TYPE_INDEX_INDEX (typeIndex )].TypeIndex );
7375 }
7476
75- return false ;
77+ return result ;
7678}
7779
7880sema_decl_type_t * MetaCSemantic_GetTypeNode (metac_sema_state_t * self ,
@@ -346,6 +348,7 @@ metac_type_index_t MetaCSemantic_GetElementType(metac_sema_state_t* self,
346348 metac_type_ptr_t * ptrType = PtrTypePtr (self , TYPE_INDEX_INDEX (typeIndex ));
347349 result = ptrType -> ElementType ;
348350 } break ;
351+ default :
349352 }
350353
351354 return result ;
@@ -1178,16 +1181,22 @@ metac_type_index_t MetaCSemantic_TypeSemantic(metac_sema_state_t* self,
11781181 placeholder -> Kind = expr_unknown_value ;
11791182 placeholder -> TypeIndex = MetaCSemantic_TypeSemantic (self , param -> Parameter -> VarType );
11801183 METAC_NODE (placeholder -> Expr ) = emptyNode ;
1184+ placeholder -> LocationIdx = locIdx ;
11811185
11821186
1183- MetaCSemantic_RegisterInScope (self , paramIdent , placeholder );
1187+ MetaCSemantic_RegisterInScope (self , paramIdent , METAC_NODE ( placeholder ) );
11841188
11851189 param = param -> Next ;
11861190 }
11871191 }
11881192
11891193 MetaCSemantic_ComputeStructLayout (self , agg , tmpSemaAgg );
11901194
1195+ if (agg -> ParameterCount != 0 )
1196+ {
1197+ MetaCSemantic_PopTemporaryScope (self );
1198+ }
1199+
11911200 MetaCSemantic_UnmountScope (self );
11921201
11931202 hash = AggregateHash (tmpSemaAgg );
@@ -1313,7 +1322,7 @@ metac_type_index_t MetaCSemantic_TypeSemantic(metac_sema_state_t* self,
13131322 {
13141323 metac_decl_t * symbol = NULL ;
13151324 metac_expr_t * arguments = cast (metac_expr_t * ) emptyNode ;
1316- uint32_t hash = crc32c_nozero (~0 , & symbol -> Hash , sizeof (symbol -> Hash ));
1325+ uint32_t hash = symbol ? crc32c_nozero (~0 , & symbol -> Hash , sizeof (symbol -> Hash )) : ~ 0 ;
13171326 uint32_t nArguments = 0 ;
13181327 for (uint32_t argIdx = 0 ; argIdx < nArguments ; argIdx ++ )
13191328 {
@@ -1331,7 +1340,7 @@ metac_type_index_t MetaCSemantic_TypeSemantic(metac_sema_state_t* self,
13311340 result = MetaCTypeTable_GetOrEmptyTemplateType (& self -> TemplateTypeTable , & key );
13321341 if (result .v == 0 )
13331342 {
1334- MetaCTypeTable_AddTemplateType (& self -> TemplateTypeTable , & key );
1343+ result = MetaCTypeTable_AddTemplateType (& self -> TemplateTypeTable , & key );
13351344 }
13361345 }
13371346
@@ -1648,7 +1657,7 @@ bool MetaCSemantic_ComputeStructLayout(metac_sema_state_t* self,
16481657#ifndef NO_FIBERS
16491658 while (!semaField -> Type .v )
16501659 {
1651- printf ("FieldType couldn't be resolved ... yielding fiber\n" );
1660+ xprintf ("FieldType couldn't be resolved ... yielding fiber\n" );
16521661 aco_t * me = (aco_t * )CurrentFiber ();
16531662 if (me != 0 )
16541663 {
@@ -1659,11 +1668,11 @@ bool MetaCSemantic_ComputeStructLayout(metac_sema_state_t* self,
16591668
16601669 assert (self -> Waiters .WaiterCount < self -> Waiters .WaiterCapacity );
16611670 self -> Waiters .Waiters [self -> Waiters .WaiterCount ++ ] = waiter ;
1662- printf ("We should Yield\n" );
1671+ xprintf ("We should Yield\n" );
16631672 (cast (task_t * )(me -> arg ))- > TaskFlags = Task_Waiting ;
16641673 YIELD (watingOnTypeSemantic );
16651674 (cast (task_t * )(me -> arg ))- > TaskFlags = Task_Running ;
1666- printf ("Now we should be able to resolve\n" );
1675+ xprintf ("Now we should be able to resolve\n" );
16671676 semaField -> Type =
16681677 MetaCSemantic_doTypeSemantic (self , declField -> Field -> VarType );
16691678 }
0 commit comments