@@ -844,7 +844,14 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
844844
845845 sema_decl_function_t * f = AllocNewSemaFunction (self , func );
846846 // for now we don't nest functions.
847+ /* TODO use semanId
848+ metac_identifier_ptr_t semaIdentifier =
849+ MetaCIdentifierTable_CopyIdentifier(self->ParserIdentifierTable,
850+ &self->SemanticIdentifierTable, func->Identifier);
851+ f->Identifier = semaIdentifier;
852+ */
847853 f -> Identifier = func -> Identifier ;
854+
848855 // printf("doing Function: %s\n", IdentifierPtrToCharPtr(self->ParserIdentifierTable, func->Identifier));
849856
850857 // let's first do the parameters
@@ -861,8 +868,16 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
861868 // as we have an easier time if we know at which
862869 // param we are and how many follow
863870 decl_variable_t * paramVar = currentParam -> Parameter ;
871+ /*TODO use identifier in sema table
872+ metac_identifier_ptr_t semaId =
873+ MetaCIdentifierTable_CopyIdentifier(self->ParserIdentifierTable,
874+ &self->SemanticIdentifierTable,
875+ paramVar->VarIdentifier);
876+ f->Parameters[i].VarIdentifier = semaId;
877+ */
878+ f -> Parameters [i ].VarIdentifier = paramVar .VarIdentifier ;
879+
864880 f -> Parameters [i ].VarFlags |= variable_is_parameter ;
865- f -> Parameters [i ].VarIdentifier = paramVar -> VarIdentifier ;
866881 if (METAC_NODE (paramVar -> VarInitExpr ) != emptyNode )
867882 {
868883 f -> Parameters [i ].VarInitExpr =
@@ -885,10 +900,6 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
885900 // now we should know the sizes
886901 assert (currentParam == emptyPointer );
887902
888- if (func -> FunctionBody == emptyPointer )
889- {
890- return f ;
891- }
892903
893904 metac_scope_owner_t Parent = {SCOPE_OWNER_V (scope_owner_function , FunctionIndex (self , f ))};
894905
@@ -947,8 +958,16 @@ sema_decl_function_t* MetaCSemantic_doFunctionSemantic(metac_sema_state_t* self,
947958 cast (metac_node_t )var );
948959 }
949960 f -> FrameOffset = frameOffset ;
950- f -> FunctionBody = cast (sema_stmt_block_t * )
951- MetaCSemantic_doStmtSemantic (self , func -> FunctionBody );
961+
962+ if (METAC_NODE (func -> FunctionBody ) != emptyNode )
963+ {
964+ f -> FunctionBody = cast (sema_stmt_block_t * )
965+ MetaCSemantic_doStmtSemantic (self , func -> FunctionBody );
966+ }
967+ else
968+ {
969+ METAC_NODE (f -> FunctionBody ) = emptyNode ;
970+ }
952971
953972 MetaCSemantic_PopScope (self );
954973
0 commit comments