| 808 | } |
| 809 | |
| 810 | void 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 | |
| 839 | void asCScriptObject::ReleaseAllHandles(asIScriptEngine *engine) |
| 840 | { |
no test coverage detected