| 5950 | } |
| 5951 | |
| 5952 | void asCScriptEngine::RemoveScriptFunction(asCScriptFunction *func) |
| 5953 | { |
| 5954 | if( func == 0 || func->id < 0 ) return; |
| 5955 | int id = func->id & ~FUNC_IMPORTED; |
| 5956 | if( func->funcType == asFUNC_IMPORTED ) |
| 5957 | { |
| 5958 | if( id >= (int)importedFunctions.GetLength() ) return; |
| 5959 | |
| 5960 | if( importedFunctions[id] ) |
| 5961 | { |
| 5962 | // Remove the function from the list of script functions |
| 5963 | if( id == (int)importedFunctions.GetLength() - 1 ) |
| 5964 | { |
| 5965 | importedFunctions.PopLast(); |
| 5966 | } |
| 5967 | else |
| 5968 | { |
| 5969 | importedFunctions[id] = 0; |
| 5970 | freeImportedFunctionIdxs.PushLast(id); |
| 5971 | } |
| 5972 | } |
| 5973 | } |
| 5974 | else |
| 5975 | { |
| 5976 | if( id >= (int)scriptFunctions.GetLength() ) return; |
| 5977 | asASSERT( func == scriptFunctions[id] ); |
| 5978 | |
| 5979 | if( scriptFunctions[id] ) |
| 5980 | { |
| 5981 | // Remove the function from the list of script functions |
| 5982 | if( id == (int)scriptFunctions.GetLength() - 1 ) |
| 5983 | { |
| 5984 | scriptFunctions.PopLast(); |
| 5985 | } |
| 5986 | else |
| 5987 | { |
| 5988 | scriptFunctions[id] = 0; |
| 5989 | freeScriptFunctionIds.PushLast(id); |
| 5990 | } |
| 5991 | |
| 5992 | // Is the function used as signature id? |
| 5993 | if( func->signatureId == id ) |
| 5994 | { |
| 5995 | // Remove the signature id |
| 5996 | signatureIds.RemoveValue(func); |
| 5997 | |
| 5998 | // Update all functions using the signature id |
| 5999 | int newSigId = 0; |
| 6000 | for( asUINT n = 0; n < scriptFunctions.GetLength(); n++ ) |
| 6001 | { |
| 6002 | if( scriptFunctions[n] && scriptFunctions[n]->signatureId == id ) |
| 6003 | { |
| 6004 | if( newSigId == 0 ) |
| 6005 | { |
| 6006 | newSigId = scriptFunctions[n]->id; |
| 6007 | signatureIds.PushLast(scriptFunctions[n]); |
| 6008 | } |
| 6009 |
no test coverage detected