| 5844 | //========================================================================== |
| 5845 | |
| 5846 | static 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 | |
| 5869 | DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinNew, BuiltinNew) |
| 5870 | { |
no test coverage detected