| 1052 | } |
| 1053 | |
| 1054 | void *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 | |
| 1084 | void asCScriptObject::FreeObject(void *ptr, asCObjectType *in_objType, asCScriptEngine *engine) |
| 1085 | { |
nothing calls this directly
no test coverage detected