[qfcc] Fix missing protocol method lists

The problem was an erroneous assumption that the methods had to be
defined. Any class implementing a protocol must implement (and thus
define) the methods, but a protocol declaration cannot: it merely
declares the methods, and it's entirely possible for a module to see
only the protocol definition and not any classes implementing the
protocol.
This commit is contained in:
Bill Currie 2020-03-02 10:52:09 +09:00
parent b6b7f9675f
commit 8021613b79
1 changed files with 6 additions and 4 deletions

View File

@ -511,9 +511,11 @@ emit_method_list_item (def_t *def, void *data, int index)
method_t *m;
pr_method_description_t *desc;
if (def->type != &type_obj_method_description)
internal_error (0, "%s: expected method_description def",
if (!is_array (def->type)
|| def->type->t.array.type != &type_obj_method_description) {
internal_error (0, "%s: expected array of method_description def",
__FUNCTION__);
}
if (index < 0 || index >= methods->count)
internal_error (0, "%s: out of bounds index: %d %d",
__FUNCTION__, index, methods->count);
@ -521,7 +523,7 @@ emit_method_list_item (def_t *def, void *data, int index)
desc = D_POINTER (pr_method_description_t, def);
for (m = methods->head; m; m = m->next) {
if (!m->instance != !methods->instance || !m->def)
if (!m->instance != !methods->instance)
continue;
if (!index--)
break;
@ -547,7 +549,7 @@ emit_method_descriptions (methodlist_t *methods, const char *name,
return 0;
for (count = 0, m = methods->head; m; m = m->next)
if (!m->instance == !instance && m->def)
if (!m->instance == !instance)
count++;
if (!count)
return 0;