mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-04 18:40:51 +00:00
get the function number early so things don't get mixed up when new functions
get created while parsing a function
This commit is contained in:
parent
4932d0db3c
commit
331df31f6a
2 changed files with 4 additions and 4 deletions
|
@ -40,6 +40,7 @@ typedef struct function_s {
|
||||||
pr_auxfunction_t *aux; // debug info;
|
pr_auxfunction_t *aux; // debug info;
|
||||||
int builtin; // if non 0, call an internal function
|
int builtin; // if non 0, call an internal function
|
||||||
int code; // first statement
|
int code; // first statement
|
||||||
|
int function_num;
|
||||||
const char *file; // source file with definition
|
const char *file; // source file with definition
|
||||||
int file_line;
|
int file_line;
|
||||||
struct def_s *def;
|
struct def_s *def;
|
||||||
|
|
|
@ -170,7 +170,7 @@ new_function (void)
|
||||||
f = calloc (1, sizeof (function_t));
|
f = calloc (1, sizeof (function_t));
|
||||||
*pr.func_tail = f;
|
*pr.func_tail = f;
|
||||||
pr.func_tail = &f->next;
|
pr.func_tail = &f->next;
|
||||||
|
f->function_num = pr.num_functions++;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ build_function (function_t *f)
|
||||||
{
|
{
|
||||||
f->def->constant = 1;
|
f->def->constant = 1;
|
||||||
f->def->initialized = 1;
|
f->def->initialized = 1;
|
||||||
G_FUNCTION (f->def->ofs) = pr.num_functions;
|
G_FUNCTION (f->def->ofs) = f->function_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -233,7 +233,7 @@ finish_function (function_t *f)
|
||||||
|
|
||||||
if (f->aux) {
|
if (f->aux) {
|
||||||
def_t *def;
|
def_t *def;
|
||||||
f->aux->function = pr.num_functions;
|
f->aux->function = f->function_num;
|
||||||
for (def = f->scope->head; def; def = def->def_next) {
|
for (def = f->scope->head; def; def = def->def_next) {
|
||||||
if (def->name) {
|
if (def->name) {
|
||||||
ddef_t *d = new_local ();
|
ddef_t *d = new_local ();
|
||||||
|
@ -245,7 +245,6 @@ finish_function (function_t *f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr.num_functions++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue