Base: Use isBad() instead of comparing types with ==

This commit is contained in:
Benjamin Nauck
2025-02-13 20:24:25 +01:00
parent 51613a5b56
commit 7186b8a88f
3 changed files with 6 additions and 6 deletions

View File

@@ -56,11 +56,11 @@ BaseClass::~BaseClass() = default;
void BaseClass::init()
{
assert(BaseClass::classTypeId == Type::badType() && "don't init() twice!");
assert(BaseClass::classTypeId.isBad() && "don't init() twice!");
/* Make sure superclass gets initialized before subclass. */
/*assert(strcmp(#_parentclass_), "inherited"));*/
/*Type parentType(Type::fromName(#_parentclass_));*/
/*assert(parentType != Type::badType() && "you forgot init() on parentclass!");*/
/*assert(!parentType.isBad() && "you forgot init() on parentclass!");*/
/* Set up entry in the type system. */
BaseClass::classTypeId =
@@ -84,11 +84,11 @@ void BaseClass::initSubclass(Base::Type& toInit,
Type::instantiationMethod method)
{
// don't init twice!
assert(toInit == Base::Type::badType());
assert(toInit.isBad());
// get the parent class
Base::Type parentType(Base::Type::fromName(ParentName));
// forgot init parent!
assert(parentType != Base::Type::badType());
assert(!parentType.isBad());
// create the new type
toInit = Base::Type::createType(parentType, ClassName, method);