interrogate: Fix bug sorting overloads of AsyncFuture::set_result()

This commit is contained in:
rdb 2021-03-01 10:59:02 +01:00
parent 89a1c8bff7
commit eab1308438

View File

@ -4283,18 +4283,19 @@ int get_type_sort(CPPType *type) {
TypeManager::is_struct(type)) {
answer = 20;
int deepest = 0;
TypeIndex type_index = builder.get_type(TypeManager::unwrap(TypeManager::resolve_type(type)), false);
InterrogateDatabase *idb = InterrogateDatabase::get_ptr();
const InterrogateType &itype = idb->get_type(type_index);
if (itype.is_class() || itype.is_struct()) {
int num_derivations = itype.number_of_derivations();
for (int di = 0; di < num_derivations; di++) {
TypeIndex d_type_Index = itype.get_derivation(di);
const InterrogateType &d_itype = idb->get_type(d_type_Index);
int this_one = get_type_sort(d_itype._cpptype);
if (this_one > deepest) {
deepest = this_one;
// Sort such that more derived classes come first.
type = TypeManager::unwrap(TypeManager::resolve_type(type));
if (type != nullptr) {
CPPStructType *struct_type = type->as_struct_type();
if (struct_type != nullptr) {
for (const CPPStructType::Base &base : struct_type->_derivation) {
if (base._base != nullptr) {
int this_one = get_type_sort(base._base);
if (this_one > deepest) {
deepest = this_one;
}
}
}
}
}