mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Get message checking working properly.
This commit is contained in:
parent
8bb507f220
commit
eace5b3c81
2 changed files with 24 additions and 7 deletions
|
@ -507,19 +507,23 @@ class_message_response (class_t *class, int class_msg, expr_t *sel)
|
|||
while (c) {
|
||||
for (cat = c->categories; cat; cat = cat->next) {
|
||||
for (m = cat->methods->head; m; m = m->next) {
|
||||
if (strcmp (selector->name, m->name) == 0)
|
||||
if (((!c->super_class && class_msg)
|
||||
|| class_msg != m->instance)
|
||||
&& strcmp (selector->name, m->name) == 0)
|
||||
return m;
|
||||
}
|
||||
}
|
||||
for (m = c->methods->head; m; m = m->next) {
|
||||
if (strcmp (selector->name, m->name) == 0)
|
||||
if (((!c->super_class && class_msg)
|
||||
|| class_msg != m->instance)
|
||||
&& strcmp (selector->name, m->name) == 0)
|
||||
return m;
|
||||
}
|
||||
c = c->super_class;
|
||||
}
|
||||
//FIXME right option?
|
||||
if (options.warnings.interface_check)
|
||||
warning (sel, "%s does not respond to %c%s", class->name,
|
||||
warning (sel, "%s may not respond to %c%s", class->name,
|
||||
class_msg ? '+' : '-', selector->name);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -2774,7 +2774,7 @@ message_expr (expr_t *receiver, keywordarg_t *message)
|
|||
expr_t *selector = selector_expr (message);
|
||||
expr_t *call;
|
||||
keywordarg_t *m;
|
||||
int super = 0, class_msg = 0;
|
||||
int self = 0, super = 0, class_msg = 0;
|
||||
type_t *rec_type;
|
||||
class_t *class;
|
||||
method_t *method;
|
||||
|
@ -2793,8 +2793,12 @@ message_expr (expr_t *receiver, keywordarg_t *message)
|
|||
class = current_class->c.category->class;
|
||||
rec_type = class->type;
|
||||
} else {
|
||||
if (receiver->type == ex_name && get_class (receiver->e.string_val, 0))
|
||||
class_msg = 1;
|
||||
if (receiver->type == ex_name) {
|
||||
if (strcmp (receiver->e.string_val, "self") == 0)
|
||||
self = 1;
|
||||
if (get_class (receiver->e.string_val, 0))
|
||||
class_msg = 1;
|
||||
}
|
||||
rec_type = get_type (receiver);
|
||||
|
||||
if (receiver->type == ex_error)
|
||||
|
@ -2804,7 +2808,16 @@ message_expr (expr_t *receiver, keywordarg_t *message)
|
|||
|| (rec_type->aux_type->type != ev_object
|
||||
&& rec_type->aux_type->type != ev_class))
|
||||
return error (receiver, "not a class/object");
|
||||
class = rec_type->aux_type->s.class;
|
||||
if (self) {
|
||||
if (current_class->is_class)
|
||||
class = current_class->c.class;
|
||||
else
|
||||
class = current_class->c.category->class;
|
||||
if (rec_type == &type_Class)
|
||||
class_msg = 1;
|
||||
} else {
|
||||
class = rec_type->aux_type->s.class;
|
||||
}
|
||||
}
|
||||
|
||||
method = class_message_response (class, class_msg, selector);
|
||||
|
|
Loading…
Reference in a new issue