MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / ReadFunction

Method ReadFunction

src/server/angelscript/angelscript/source/as_restore.cpp:1148–1541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1146}
1147
1148asCScriptFunction *asCReader::ReadFunction(bool &isNew, bool addToModule, bool addToEngine, bool addToGC, bool *isExternal)
1149{
1150 isNew = false;
1151 if (isExternal) *isExternal = false;
1152 if( error ) return 0;
1153
1154 char c;
1155 ReadData(&c, 1);
1156
1157 if( c == '\0' )
1158 {
1159 // There is no function, so return a null pointer
1160 return 0;
1161 }
1162
1163 if( c == 'r' )
1164 {
1165 // This is a reference to a previously saved function
1166 asUINT index = ReadEncodedUInt();
1167 if( index < savedFunctions.GetLength() )
1168 return savedFunctions[index];
1169 else
1170 {
1171 Error(TXT_INVALID_BYTECODE_d);
1172 return 0;
1173 }
1174 }
1175
1176 // Load the new function
1177 isNew = true;
1178 asCScriptFunction *func = asNEW(asCScriptFunction)(engine,0,asFUNC_DUMMY);
1179 if( func == 0 )
1180 {
1181 // Out of memory
1182 error = true;
1183 return 0;
1184 }
1185 savedFunctions.PushLast(func);
1186
1187 int i, count;
1188 asCDataType dt;
1189 int num;
1190
1191 asCObjectType *parentClass = 0;
1192 ReadFunctionSignature(func, &parentClass);
1193 if( error )
1194 {
1195 func->DestroyHalfCreated();
1196 return 0;
1197 }
1198
1199 if( func->funcType == asFUNC_SCRIPT )
1200 {
1201 // Skip this for external shared entities
1202 if (module->m_externalTypes.IndexOf(func->objectType) >= 0)
1203 {
1204 // Replace with the real function from the existing entity
1205 isNew = false;

Callers

nothing calls this directly

Calls 15

PushLastMethod · 0.80
DestroyHalfCreatedMethod · 0.80
IndexOfMethod · 0.80
IsSignatureEqualMethod · 0.80
SetSharedMethod · 0.80
SetExplicitMethod · 0.80
AddScriptObjectToGCMethod · 0.80
WriteMessageMethod · 0.80
PopLastMethod · 0.80

Tested by

no test coverage detected