mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[qfcc] Fix mangled method parameters
Method parameters (ie, extra parameters without selector names) were getting reversed during function type construction.
This commit is contained in:
parent
a2cebe3cac
commit
9b269c2f8e
5 changed files with 32 additions and 7 deletions
|
@ -119,8 +119,8 @@ param_t *new_param (const char *selector, struct type_s *type,
|
|||
const char *name);
|
||||
param_t *param_append_identifiers (param_t *params, struct symbol_s *idents,
|
||||
struct type_s *type);
|
||||
param_t *_reverse_params (param_t *params, param_t *next);
|
||||
param_t *reverse_params (param_t *params);
|
||||
param_t *append_params (param_t *params, param_t *more_params);
|
||||
param_t *copy_params (param_t *params);
|
||||
struct type_s *parse_params (struct type_s *type, param_t *params);
|
||||
param_t *check_params (param_t *params);
|
||||
|
|
|
@ -120,7 +120,7 @@ param_append_identifiers (param_t *params, symbol_t *idents, type_t *type)
|
|||
return params;
|
||||
}
|
||||
|
||||
param_t *
|
||||
static param_t *
|
||||
_reverse_params (param_t *params, param_t *next)
|
||||
{
|
||||
param_t *p = params;
|
||||
|
@ -138,6 +138,20 @@ reverse_params (param_t *params)
|
|||
return _reverse_params (params, 0);
|
||||
}
|
||||
|
||||
param_t *
|
||||
append_params (param_t *params, param_t *more_params)
|
||||
{
|
||||
if (params) {
|
||||
param_t *p;
|
||||
for (p = params; p->next; ) {
|
||||
p = p->next;
|
||||
}
|
||||
p->next = more_params;
|
||||
return params;
|
||||
}
|
||||
return more_params;
|
||||
}
|
||||
|
||||
param_t *
|
||||
copy_params (param_t *params)
|
||||
{
|
||||
|
|
|
@ -89,8 +89,8 @@ new_method (type_t *ret_type, param_t *selector, param_t *opt_params)
|
|||
dstring_t *name = dstring_newstr ();
|
||||
dstring_t *types = dstring_newstr ();
|
||||
|
||||
opt_params = reverse_params (opt_params);
|
||||
selector = _reverse_params (selector, opt_params);
|
||||
selector = reverse_params (selector);
|
||||
selector = append_params (selector, opt_params);
|
||||
cmd->next = selector;
|
||||
self->next = cmd;
|
||||
|
||||
|
@ -109,7 +109,7 @@ new_method (type_t *ret_type, param_t *selector, param_t *opt_params)
|
|||
free (name);
|
||||
free (types);
|
||||
|
||||
//print_type (meth->type); puts ("");
|
||||
//print_type (meth->type);
|
||||
meth->def = 0;
|
||||
|
||||
if (!known_methods)
|
||||
|
|
|
@ -2010,8 +2010,7 @@ optional_param_list
|
|||
| ',' param_list { $$ = $2; }
|
||||
| ',' param_list ',' ELLIPSIS
|
||||
{
|
||||
$$ = new_param (0, 0, 0);
|
||||
$$->next = $2;
|
||||
$$ = param_append_identifiers ($2, 0, 0);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -15,3 +15,15 @@ typedef struct { int x, y; } Point;
|
|||
[textContext mvvprintf: pos, fmt, @args];
|
||||
}
|
||||
@end
|
||||
id obj_msgSend (id receiver, SEL op, ...) = #0;
|
||||
void __obj_exec_class (struct obj_module *msg) = #0;
|
||||
@interface Object
|
||||
@end
|
||||
@implementation Object
|
||||
@end
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return 0; // to survive and prevail :)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue