MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ParseFunctionCall

Method ParseFunctionCall

neo/game/script/Script_Compiler.cpp:1078–1113  ·  view source on GitHub ↗

============ idCompiler::ParseFunctionCall ============ */

Source from the content-addressed store, hash-verified

1076============
1077*/
1078idVarDef *idCompiler::ParseFunctionCall( idVarDef *funcDef ) {
1079 assert( funcDef );
1080
1081 if ( funcDef->Type() != ev_function ) {
1082 Error( "'%s' is not a function", funcDef->Name() );
1083 }
1084
1085 if ( funcDef->initialized == idVarDef::uninitialized ) {
1086 Error( "Function '%s' has not been defined yet", funcDef->GlobalName() );
1087 }
1088
1089 assert( funcDef->value.functionPtr );
1090 if ( callthread ) {
1091 if ( ( funcDef->initialized != idVarDef::uninitialized ) && funcDef->value.functionPtr->eventdef ) {
1092 Error( "Built-in functions cannot be called as threads" );
1093 }
1094 callthread = false;
1095 return EmitFunctionParms( OP_THREAD, funcDef, 0, 0, NULL );
1096 } else {
1097 if ( ( funcDef->initialized != idVarDef::uninitialized ) && funcDef->value.functionPtr->eventdef ) {
1098 if ( ( scope->Type() != ev_namespace ) && ( scope->scope->Type() == ev_object ) ) {
1099 // get the local object pointer
1100 idVarDef *thisdef = gameLocal.program.GetDef( scope->scope->TypeDef(), "self", scope );
1101 if ( !thisdef ) {
1102 Error( "No 'self' within scope" );
1103 }
1104
1105 return ParseEventCall( thisdef, funcDef );
1106 } else {
1107 Error( "Built-in functions cannot be called without an object" );
1108 }
1109 }
1110
1111 return EmitFunctionParms( OP_CALL, funcDef, 0, 0, NULL );
1112 }
1113}
1114
1115/*
1116============

Callers

nothing calls this directly

Calls 6

ErrorFunction · 0.50
TypeMethod · 0.45
NameMethod · 0.45
GlobalNameMethod · 0.45
GetDefMethod · 0.45
TypeDefMethod · 0.45

Tested by

no test coverage detected