MCPcopy Create free account
hub / github.com/anjo76/angelscript / FindNewOwnerForSharedType

Method FindNewOwnerForSharedType

sdk/angelscript/source/as_scriptengine.cpp:1008–1040  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

1006
1007// internal
1008asCModule *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
1043asCModule *asCScriptEngine::FindNewOwnerForSharedFunc(asCScriptFunction *in_func, asCModule *in_mod)

Callers 2

HasExternalReferencesMethod · 0.80
InternalResetMethod · 0.80

Calls 7

CastToEnumTypeFunction · 0.85
CastToTypedefTypeFunction · 0.85
CastToFuncdefTypeFunction · 0.85
CastToObjectTypeFunction · 0.85
IndexOfMethod · 0.80
IsSharedMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected