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

Method AllocateUninitializedObject

sdk/angelscript/source/as_scriptobject.cpp:1054–1082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1052}
1053
1054void *asCScriptObject::AllocateUninitializedObject(asCObjectType *in_objType, asCScriptEngine *engine)
1055{
1056 void *ptr = 0;
1057
1058 if( in_objType->flags & asOBJ_SCRIPT_OBJECT )
1059 {
1060 ptr = engine->CallAlloc(in_objType);
1061 ScriptObject_ConstructUnitialized(in_objType, reinterpret_cast<asCScriptObject*>(ptr));
1062 }
1063 else if( in_objType->flags & asOBJ_TEMPLATE )
1064 {
1065 // Templates store the original factory that takes the object
1066 // type as a hidden parameter in the construct behaviour
1067 ptr = engine->CallGlobalFunctionRetPtr(in_objType->beh.construct, in_objType);
1068 }
1069 else if( in_objType->flags & asOBJ_REF )
1070 {
1071 ptr = engine->CallGlobalFunctionRetPtr(in_objType->beh.factory);
1072 }
1073 else
1074 {
1075 ptr = engine->CallAlloc(in_objType);
1076 int funcIndex = in_objType->beh.construct;
1077 if( funcIndex )
1078 engine->CallObjectMethod(ptr, funcIndex);
1079 }
1080
1081 return ptr;
1082}
1083
1084void asCScriptObject::FreeObject(void *ptr, asCObjectType *in_objType, asCScriptEngine *engine)
1085{

Callers

nothing calls this directly

Calls 4

CallAllocMethod · 0.80
CallObjectMethodMethod · 0.80

Tested by

no test coverage detected