mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 04:30:43 +00:00
class.c:
avoid possible segfault expr.c: correct the return value type checking to handle super classes
This commit is contained in:
parent
3a99ab8cea
commit
4315707008
2 changed files with 6 additions and 4 deletions
|
@ -304,9 +304,11 @@ class_message_response (class_t *class, expr_t *sel)
|
|||
selector = &G_STRUCT (pr_sel_t, sel->e.pointer.val);
|
||||
sel_name = strings + selector->sel_id;
|
||||
while (c) {
|
||||
for (m = c->methods->head; m; m = m->next) {
|
||||
if (strcmp (sel_name, m->name) == 0)
|
||||
return m;
|
||||
if (c->methods) {
|
||||
for (m = c->methods->head; m; m = m->next) {
|
||||
if (strcmp (sel_name, m->name) == 0)
|
||||
return m;
|
||||
}
|
||||
}
|
||||
c = c->super_class;
|
||||
}
|
||||
|
|
|
@ -1658,7 +1658,7 @@ return_expr (function_t *f, expr_t *e)
|
|||
t = f->def->type->aux_type;
|
||||
e->type = expr_types[t->type];
|
||||
}
|
||||
if (f->def->type->aux_type != t)
|
||||
if (!type_assignable (f->def->type->aux_type, t))
|
||||
return error (e, "type mismatch for return value of %s",
|
||||
f->def->name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue