mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-09 09:11:05 +00:00
got function params scope sort of sorted out
This commit is contained in:
parent
eeaab95be5
commit
b595f0122f
1 changed files with 21 additions and 4 deletions
|
@ -54,6 +54,7 @@ type_t *PR_FindType (type_t *new);
|
||||||
|
|
||||||
type_t *current_type;
|
type_t *current_type;
|
||||||
def_t *current_def;
|
def_t *current_def;
|
||||||
|
def_t param_scope;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -91,7 +92,22 @@ def_list
|
||||||
|
|
||||||
def_item
|
def_item
|
||||||
: def_name opt_initializer
|
: def_name opt_initializer
|
||||||
| '(' param_list ')' def_name opt_definition {}
|
| '('
|
||||||
|
{
|
||||||
|
pr_scope = ¶m_scope;
|
||||||
|
}
|
||||||
|
param_list
|
||||||
|
{
|
||||||
|
$$ = param_scope.scope_next;
|
||||||
|
param_scope.scope_next = 0;
|
||||||
|
pr_scope = 0;
|
||||||
|
}
|
||||||
|
')' def_name opt_definition
|
||||||
|
{
|
||||||
|
def_t scope;
|
||||||
|
scope.scope_next=$<def>4;
|
||||||
|
PR_FlushScope (&scope);
|
||||||
|
}
|
||||||
| '(' ')' def_name opt_definition {}
|
| '(' ')' def_name opt_definition {}
|
||||||
| '(' ELIPSIS ')' def_name opt_definition {}
|
| '(' ELIPSIS ')' def_name opt_definition {}
|
||||||
;
|
;
|
||||||
|
@ -99,7 +115,6 @@ def_item
|
||||||
def_name
|
def_name
|
||||||
: NAME
|
: NAME
|
||||||
{
|
{
|
||||||
printf ("%s\n", $1);
|
|
||||||
$$ = PR_GetDef (current_type, $1, pr_scope, pr_scope ? &pr_scope->num_locals : &numpr_globals);
|
$$ = PR_GetDef (current_type, $1, pr_scope, pr_scope ? &pr_scope->num_locals : &numpr_globals);
|
||||||
current_def = $$;
|
current_def = $$;
|
||||||
}
|
}
|
||||||
|
@ -109,8 +124,8 @@ param_list
|
||||||
: param
|
: param
|
||||||
| param_list ',' param
|
| param_list ',' param
|
||||||
{
|
{
|
||||||
$1->next = $3;
|
$3->next = $1;
|
||||||
$$ = $1;
|
$$ = $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -118,7 +133,9 @@ param
|
||||||
: type def_item
|
: type def_item
|
||||||
{
|
{
|
||||||
$2->type = $1;
|
$2->type = $1;
|
||||||
|
$2->next = 0;
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
printf ("%s ", $2->name);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue