handle param name changes between prototype and declaration gracefully

This is an imperfect revision of history.
This commit is contained in:
Bill Currie 2004-11-02 23:54:00 +00:00 committed by Jeff Teunissen
parent 9f52181e34
commit b46cff08aa
2 changed files with 16 additions and 0 deletions

View file

@ -74,6 +74,7 @@ method_t *new_method (struct type_s *ret_type, param_t *selector,
method_t *copy_method (method_t *method); method_t *copy_method (method_t *method);
void add_method (methodlist_t *methodlist, method_t *method); void add_method (methodlist_t *methodlist, method_t *method);
struct def_s *method_def (struct class_type_s *class_type, method_t *method); struct def_s *method_def (struct class_type_s *class_type, method_t *method);
void method_set_param_names (method_t *dst, method_t *src);
methodlist_t *new_methodlist (void); methodlist_t *new_methodlist (void);
void copy_methods (methodlist_t *dst, methodlist_t *src); void copy_methods (methodlist_t *dst, methodlist_t *src);

View file

@ -174,6 +174,21 @@ method_def (class_type_t *class_type, method_t *method)
return def; return def;
} }
void
method_set_param_names (method_t *dst, method_t *src)
{
param_t *dp, *sp;
for (dp = dst->params, sp = src->params; dp && sp;
dp = dp->next, sp = sp->next) {
dp->name = sp->name;
}
if (dp || sp) {
error (0, "internal compiler error: missmatched method params");
abort ();
}
}
methodlist_t * methodlist_t *
new_methodlist (void) new_methodlist (void)
{ {