internal
| 1006 | |
| 1007 | // internal |
| 1008 | asCModule *asCScriptEngine::FindNewOwnerForSharedType(asCTypeInfo *in_type, asCModule *in_mod) |
| 1009 | { |
| 1010 | asASSERT( in_type->IsShared() ); |
| 1011 | |
| 1012 | if( in_type->module != in_mod) |
| 1013 | return in_type->module; |
| 1014 | |
| 1015 | for( asUINT n = 0; n < scriptModules.GetLength(); n++ ) |
| 1016 | { |
| 1017 | // TODO: optimize: If the modules already stored the shared types separately, this would be quicker |
| 1018 | int foundIdx = -1; |
| 1019 | asCModule *mod = scriptModules[n]; |
| 1020 | if( mod == in_type->module ) continue; |
| 1021 | if( in_type->flags & asOBJ_ENUM ) |
| 1022 | foundIdx = mod->m_enumTypes.IndexOf(CastToEnumType(in_type)); |
| 1023 | else if (in_type->flags & asOBJ_TYPEDEF) |
| 1024 | foundIdx = mod->m_typeDefs.IndexOf(CastToTypedefType(in_type)); |
| 1025 | else if (in_type->flags & asOBJ_FUNCDEF) |
| 1026 | foundIdx = mod->m_funcDefs.IndexOf(CastToFuncdefType(in_type)); |
| 1027 | else if (in_type->flags & asOBJ_TEMPLATE) |
| 1028 | foundIdx = mod->m_templateInstances.IndexOf(CastToObjectType(in_type)); |
| 1029 | else |
| 1030 | foundIdx = mod->m_classTypes.IndexOf(CastToObjectType(in_type)); |
| 1031 | |
| 1032 | if( foundIdx >= 0 ) |
| 1033 | { |
| 1034 | in_type->module = mod; |
| 1035 | break; |
| 1036 | } |
| 1037 | } |
| 1038 | |
| 1039 | return in_type->module; |
| 1040 | } |
| 1041 | |
| 1042 | // internal |
| 1043 | asCModule *asCScriptEngine::FindNewOwnerForSharedFunc(asCScriptFunction *in_func, asCModule *in_mod) |
no test coverage detected