Added reasons to assertions

This commit is contained in:
2023-07-23 10:15:37 -07:00
parent 1b0218c9f3
commit a5b36fb24a
79 changed files with 359 additions and 291 deletions

View File

@ -132,7 +132,7 @@ namespace Dawn {
// all the listeners on StateProperty<> that belong to this StateOwner
// I need to keep track of what events I've subbed to, consuming more
// memory, and I don't know if I actually need to do this or not.
assertTrue(property.owner == this);
assertTrue(property.owner == this, "StateOwner::useEffect: Property owner must be this StateOwner");
}
property._effectListners.push_back(fn);
return fn;
@ -156,7 +156,7 @@ namespace Dawn {
if(property->owner == nullptr) {
property->owner = this;
} else {
assertTrue(property->owner == this);
assertTrue(property->owner == this, "StateOwner::useEffect: Property owner must be this StateOwner");
}
property->_effectListners.push_back(fn);
++itProp;
@ -177,7 +177,11 @@ namespace Dawn {
const std::function<std::function<void()>()> &fn,
IStateProperty &property
) {
if(property.owner == nullptr) { property.owner = this; } else { assertTrue(property.owner == this); }
if(property.owner == nullptr) {
property.owner = this;
} else {
assertTrue(property.owner == this, "StateOwner::useEffectWithTeardown: Property owner must be this StateOwner");
}
property._effectListnersWithTeardown.push_back(fn);
return std::bind([&](

View File

@ -40,7 +40,7 @@ namespace Dawn {
auto unsub = std::bind([&](struct StateListener<D, A...> listener) {
// Not yet implemented
assertUnreachable();
assertUnreachable("StateProviderSet::addEffect: Not yet implemented");
}, l);
context->_stateProviderListeners.push_back(unsub);