bool asCDataType::CanBeInstantiated() const { if( GetSizeOnStackDWords() == 0 ) // Void return false; if( !IsObject() && !IsFuncdef() ) // Primitives return true; if (IsNullHandle()) // null return false; if( IsObjectHandle() && !(typeInfo->flags & asOBJ_NOHANDLE) ) // Handles return true; // Funcdefs cannot be instantiated without being handles // The exception being delegates, but these can only be created as temporary objects if (IsFuncdef()) return false; asCObjectType *ot = typeInfo->CastToObjectType(); if( ot && (ot->flags & asOBJ_REF) && ot->beh.factories.GetLength() == 0 ) // ref types without factories return false; if( ot && (ot->flags & asOBJ_ABSTRACT) && !IsObjectHandle() ) // Can't instantiate abstract classes return false; return true; }
bool asCDataType::CanBeInstanciated() const { if( GetSizeOnStackDWords() == 0 || (IsObject() && (objectType->flags & asOBJ_REF) && // It's a ref type and ((objectType->flags & asOBJ_NOHANDLE) || // the ref type doesn't support handles or (!IsObjectHandle() && // it's not a handle and objectType->beh.factories.GetLength() == 0))) ) // the ref type cannot be instanciated return false; return true; }
bool asCDataType::CanBeInstantiated() const { if( GetSizeOnStackDWords() == 0 ) // Void return false; if( !IsObject() ) // Primitives return true; if( IsObjectHandle() && !(objectType->flags & asOBJ_NOHANDLE) ) // Handles return true; if( funcDef ) // Funcdefs can be instantiated as delegates return true; if( (objectType->flags & asOBJ_REF) && objectType->beh.factories.GetLength() == 0 ) // ref types without factories return false; if( (objectType->flags & asOBJ_ABSTRACT) && !IsObjectHandle() ) // Can't instantiate abstract classes return false; return true; }