MCPcopy Create free account
hub / github.com/ZDoom/Raze / BuiltinNew

Function BuiltinNew

source/common/scripting/backend/codegen.cpp:5846–5867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5844//==========================================================================
5845
5846static DObject *BuiltinNew(PClass *cls, int outerside, int backwardscompatible)
5847{
5848 if (cls == nullptr)
5849 {
5850 ThrowAbortException(X_OTHER, "New without a class");
5851 return nullptr;
5852 }
5853 if (cls->ConstructNative == nullptr)
5854 {
5855 ThrowAbortException(X_OTHER, "Class %s requires native construction", cls->TypeName.GetChars());
5856 return nullptr;
5857 }
5858 if (cls->bAbstract)
5859 {
5860 ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
5861 return nullptr;
5862 }
5863 // [ZZ] validate readonly and between scope construction
5864 if (outerside) FScopeBarrier::ValidateNew(cls, outerside - 1);
5865 DObject *object = cls->CreateNew();
5866 return object;
5867}
5868
5869DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinNew, BuiltinNew)
5870{

Callers 1

Calls 3

ThrowAbortExceptionFunction · 0.85
CreateNewMethod · 0.80
GetCharsMethod · 0.45

Tested by

no test coverage detected