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

Method EnumReferences

sdk/angelscript/source/as_scriptobject.cpp:810–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

808}
809
810void asCScriptObject::EnumReferences(asIScriptEngine *engine)
811{
812 // We'll notify the GC of all object handles that we're holding
813 for( asUINT n = 0; n < objType->properties.GetLength(); n++ )
814 {
815 asCObjectProperty *prop = objType->properties[n];
816 void *ptr = 0;
817 if (prop->type.IsObject())
818 {
819 if (prop->type.IsReference() || (prop->type.GetTypeInfo()->flags & asOBJ_REF))
820 ptr = *(void**)(((char*)this) + prop->byteOffset);
821 else
822 ptr = (void*)(((char*)this) + prop->byteOffset);
823
824 // The members of the value type needs to be enumerated
825 // too, since the value type may be holding a reference.
826 if ((prop->type.GetTypeInfo()->flags & asOBJ_VALUE) && (prop->type.GetTypeInfo()->flags & asOBJ_GC))
827 {
828 reinterpret_cast<asCScriptEngine*>(engine)->CallObjectMethod(ptr, engine, CastToObjectType(prop->type.GetTypeInfo())->beh.gcEnumReferences);
829 }
830 }
831 else if (prop->type.IsFuncdef())
832 ptr = *(void**)(((char*)this) + prop->byteOffset);
833
834 if (ptr)
835 ((asCScriptEngine*)engine)->GCEnumCallback(ptr);
836 }
837}
838
839void asCScriptObject::ReleaseAllHandles(asIScriptEngine *engine)
840{

Callers 1

Calls 8

CastToObjectTypeFunction · 0.85
IsObjectMethod · 0.80
GetTypeInfoMethod · 0.80
CallObjectMethodMethod · 0.80
IsFuncdefMethod · 0.80
GetLengthMethod · 0.45
IsReferenceMethod · 0.45
GCEnumCallbackMethod · 0.45

Tested by

no test coverage detected