mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Make new_function take a def rather than a name.
Moves into new_function some code that should have been there in the first place.
This commit is contained in:
parent
4c69a97ac7
commit
a1f36a9944
4 changed files with 8 additions and 10 deletions
|
@ -84,7 +84,7 @@ struct def_s *get_function_def (const char *name, struct type_s *type,
|
||||||
int overload, int create);
|
int overload, int create);
|
||||||
struct expr_s *find_function (struct expr_s *fexpr, struct expr_s *params);
|
struct expr_s *find_function (struct expr_s *fexpr, struct expr_s *params);
|
||||||
void build_scope (function_t *f, struct def_s *func, param_t *params);
|
void build_scope (function_t *f, struct def_s *func, param_t *params);
|
||||||
function_t *new_function (const char *name);
|
function_t *new_function (struct def_s *func);
|
||||||
void add_function (function_t *f);
|
void add_function (function_t *f);
|
||||||
function_t *build_code_function (function_t *f, struct expr_s *state_expr,
|
function_t *build_code_function (function_t *f, struct expr_s *state_expr,
|
||||||
struct expr_s *statements);
|
struct expr_s *statements);
|
||||||
|
|
|
@ -825,9 +825,8 @@ class_finish_module (void)
|
||||||
pr.scope, st_extern);
|
pr.scope, st_extern);
|
||||||
|
|
||||||
init_def = get_def (&type_function, ".ctor", pr.scope, st_static);
|
init_def = get_def (&type_function, ".ctor", pr.scope, st_static);
|
||||||
current_func = init_func = new_function (".ctor");
|
current_func = init_func = new_function (init_def);
|
||||||
add_function (init_func);
|
add_function (init_func);
|
||||||
init_func->def = init_def;
|
|
||||||
reloc_def_func (init_func, init_def->ofs);
|
reloc_def_func (init_func, init_def->ofs);
|
||||||
init_func->code = pr.code->size;
|
init_func->code = pr.code->size;
|
||||||
build_scope (init_func, init_def, 0);
|
build_scope (init_func, init_def, 0);
|
||||||
|
|
|
@ -420,13 +420,14 @@ build_scope (function_t *f, def_t *func, param_t *params)
|
||||||
}
|
}
|
||||||
|
|
||||||
function_t *
|
function_t *
|
||||||
new_function (const char *name)
|
new_function (def_t *func)
|
||||||
{
|
{
|
||||||
function_t *f;
|
function_t *f;
|
||||||
|
|
||||||
ALLOC (1024, function_t, functions, f);
|
ALLOC (1024, function_t, functions, f);
|
||||||
f->s_name = ReuseString (name);
|
f->s_name = ReuseString (func->name);
|
||||||
f->s_file = pr.source_file;
|
f->s_file = pr.source_file;
|
||||||
|
f->def = func;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,12 +474,11 @@ build_builtin_function (def_t *def, expr_t *bi_val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = new_function (def->name);
|
f = new_function (def);
|
||||||
add_function (f);
|
add_function (f);
|
||||||
|
|
||||||
f->builtin = bi_val->type == ex_integer ? bi_val->e.integer_val
|
f->builtin = bi_val->type == ex_integer ? bi_val->e.integer_val
|
||||||
: (int)bi_val->e.float_val;
|
: (int)bi_val->e.float_val;
|
||||||
f->def = def;
|
|
||||||
reloc_def_func (f, def->ofs);
|
reloc_def_func (f, def->ofs);
|
||||||
build_function (f);
|
build_function (f);
|
||||||
finish_function (f);
|
finish_function (f);
|
||||||
|
|
|
@ -727,8 +727,7 @@ begin_function
|
||||||
{
|
{
|
||||||
if ($<def>0->constant)
|
if ($<def>0->constant)
|
||||||
error (0, "%s redefined", $<def>0->name);
|
error (0, "%s redefined", $<def>0->name);
|
||||||
$$ = current_func = new_function ($<def>0->name);
|
$$ = current_func = new_function ($<def>0);
|
||||||
$$->def = $<def>0;
|
|
||||||
if (!$$->def->external) {
|
if (!$$->def->external) {
|
||||||
add_function ($$);
|
add_function ($$);
|
||||||
reloc_def_func ($$, $$->def->ofs);
|
reloc_def_func ($$, $$->def->ofs);
|
||||||
|
@ -743,7 +742,7 @@ begin_function
|
||||||
|
|
||||||
lineno->fa.func = $$->aux - pr.auxfunctions;
|
lineno->fa.func = $$->aux - pr.auxfunctions;
|
||||||
}
|
}
|
||||||
build_scope ($$, $<def>0, current_params);
|
build_scope ($$, $$->def, current_params);
|
||||||
current_scope = $$->scope;
|
current_scope = $$->scope;
|
||||||
current_storage = st_local;
|
current_storage = st_local;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue