[*] Enforce tags around here

This commit is contained in:
Reece Wilson 2023-10-21 08:01:46 +01:00
parent 73f6f6ea1e
commit bd11c0860d

View File

@ -90,10 +90,18 @@ namespace Aurora::Memory
{ {
if constexpr (AuIsTuple_v<AuRemoveReference_t<T>>) if constexpr (AuIsTuple_v<AuRemoveReference_t<T>>)
{ {
if (this->ReadTagged<AuUInt16> !=
AuTupleCountOf_v<AuRemoveReference_t<T>>)
{
this->flagReadError = true;
return false;
}
AuTupleForEach(out, [=](auto &tupleElement) AuTupleForEach(out, [=](auto &tupleElement)
{ {
Read(tupleElement); ReadTagged(tupleElement);
}); });
return !this->flagReadError; return !this->flagReadError;
} }
else if constexpr (AuIsOptional_v<AuRemoveReference_t<T>>) else if constexpr (AuIsOptional_v<AuRemoveReference_t<T>>)
@ -102,7 +110,7 @@ namespace Aurora::Memory
{ {
AuRemoveReference_t<decltype(out.value())> value; AuRemoveReference_t<decltype(out.value())> value;
Read(value); ReadTagged(value);
if (this->flagReadError) if (this->flagReadError)
{ {
@ -246,16 +254,19 @@ namespace Aurora::Memory
{ {
if constexpr (AuIsTuple_v<AuRemoveReference_t<T>>) if constexpr (AuIsTuple_v<AuRemoveReference_t<T>>)
{ {
this->WriteTagged<AuUInt16>(AuTupleCountOf_v<AuRemoveReference_t<T>>);
AuTupleForEach(in, [=](auto &tupleElement) AuTupleForEach(in, [=](auto &tupleElement)
{ {
Write(tupleElement); WriteTagged(tupleElement);
}); });
return !this->flagWriteError; return !this->flagWriteError;
} }
else if constexpr (AuIsOptional_v<AuRemoveReference_t<T>>) else if constexpr (AuIsOptional_v<AuRemoveReference_t<T>>)
{ {
Write<bool>(AuStaticCast<bool>(in)); Write<bool>(AuStaticCast<bool>(in));
Write(in.value()); WriteTagged(in.value());
return !this->flagWriteError; return !this->flagWriteError;
} }
else if constexpr (AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, AuRemoveReference_t<T>>::value) else if constexpr (AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, AuRemoveReference_t<T>>::value)