mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Use the method's selector rather than its def name in error messages.
This commit is contained in:
parent
a1f36a9944
commit
5627e43465
7 changed files with 31 additions and 16 deletions
|
@ -56,6 +56,7 @@ typedef struct function_s {
|
|||
struct scope_s *scope;
|
||||
struct reloc_s *refs;
|
||||
struct expr_s *var_init;
|
||||
const char *name;
|
||||
} function_t;
|
||||
|
||||
extern function_t *current_func;
|
||||
|
@ -84,7 +85,7 @@ struct def_s *get_function_def (const char *name, struct type_s *type,
|
|||
int overload, int create);
|
||||
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);
|
||||
function_t *new_function (struct def_s *func);
|
||||
function_t *new_function (struct def_s *func, const char *nice_name);
|
||||
void add_function (function_t *f);
|
||||
function_t *build_code_function (function_t *f, struct expr_s *state_expr,
|
||||
struct expr_s *statements);
|
||||
|
|
|
@ -71,6 +71,7 @@ struct dstring_s;
|
|||
|
||||
method_t *new_method (struct type_s *ret_type, param_t *selector,
|
||||
param_t *opt_parms);
|
||||
const char *method_name (method_t *method);
|
||||
method_t *copy_method (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);
|
||||
|
|
|
@ -825,7 +825,7 @@ class_finish_module (void)
|
|||
pr.scope, st_extern);
|
||||
|
||||
init_def = get_def (&type_function, ".ctor", pr.scope, st_static);
|
||||
current_func = init_func = new_function (init_def);
|
||||
current_func = init_func = new_function (init_def, 0);
|
||||
add_function (init_func);
|
||||
reloc_def_func (init_func, init_def->ofs);
|
||||
init_func->code = pr.code->size;
|
||||
|
|
|
@ -2881,7 +2881,7 @@ report_function (expr_t *e)
|
|||
if (current_func != last_func) {
|
||||
if (current_func) {
|
||||
fprintf (stderr, "%s: In function `%s':\n", G_GETSTR (file),
|
||||
current_func->def->name);
|
||||
current_func->name);
|
||||
} else if (current_class) {
|
||||
fprintf (stderr, "%s: In class `%s':\n", G_GETSTR (file),
|
||||
get_class_name (current_class, 1));
|
||||
|
|
|
@ -420,7 +420,7 @@ build_scope (function_t *f, def_t *func, param_t *params)
|
|||
}
|
||||
|
||||
function_t *
|
||||
new_function (def_t *func)
|
||||
new_function (def_t *func, const char *nice_name)
|
||||
{
|
||||
function_t *f;
|
||||
|
||||
|
@ -428,6 +428,8 @@ new_function (def_t *func)
|
|||
f->s_name = ReuseString (func->name);
|
||||
f->s_file = pr.source_file;
|
||||
f->def = func;
|
||||
if (!(f->name = nice_name))
|
||||
f->name = f->def->name;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -474,7 +476,7 @@ build_builtin_function (def_t *def, expr_t *bi_val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
f = new_function (def);
|
||||
f = new_function (def, 0);
|
||||
add_function (f);
|
||||
|
||||
f->builtin = bi_val->type == ex_integer ? bi_val->e.integer_val
|
||||
|
|
|
@ -116,6 +116,12 @@ new_method (type_t *ret_type, param_t *selector, param_t *opt_parms)
|
|||
return meth;
|
||||
}
|
||||
|
||||
const char *
|
||||
method_name (method_t *method)
|
||||
{
|
||||
return nva ("%c%s", method->instance ? '-' : '+', method->name);
|
||||
}
|
||||
|
||||
method_t *
|
||||
copy_method (method_t *method)
|
||||
{
|
||||
|
|
|
@ -290,13 +290,15 @@ cfunction
|
|||
}
|
||||
| cfunction_def opt_state_expr
|
||||
{ $<op>$ = current_storage; }
|
||||
{ $<string_val>$ = 0; }
|
||||
{ $<def>$ = $1; }
|
||||
begin_function statement_block { $<op>$ = $<op>3; } end_function
|
||||
{
|
||||
build_code_function ($5, $2, $6);
|
||||
build_code_function ($6, $2, $7);
|
||||
current_func = 0;
|
||||
(void) ($<def>4);
|
||||
(void) ($<op>7);
|
||||
(void) ($<string_val>4);
|
||||
(void) ($<def>5);
|
||||
(void) ($<op>8);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -559,13 +561,15 @@ non_code_func
|
|||
code_func
|
||||
: '=' opt_state_expr
|
||||
{ $<op>$ = current_storage; }
|
||||
{ $<string_val>$ = 0; }
|
||||
{ $<def>$ = $<def>0; }
|
||||
begin_function statement_block { $<op>$ = $<op>3; } end_function
|
||||
{
|
||||
build_code_function ($5, $2, $6);
|
||||
build_code_function ($6, $2, $7);
|
||||
current_func = 0;
|
||||
(void) ($<def>4);
|
||||
(void) ($<op>7);
|
||||
(void) ($<string_val>4);
|
||||
(void) ($<def>5);
|
||||
(void) ($<op>8);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -727,7 +731,7 @@ begin_function
|
|||
{
|
||||
if ($<def>0->constant)
|
||||
error (0, "%s redefined", $<def>0->name);
|
||||
$$ = current_func = new_function ($<def>0);
|
||||
$$ = current_func = new_function ($<def>0, $<string_val>-1);
|
||||
if (!$$->def->external) {
|
||||
add_function ($$);
|
||||
reloc_def_func ($$, $$->def->ofs);
|
||||
|
@ -1462,7 +1466,6 @@ ivar_decl_list
|
|||
{
|
||||
$$ = current_ivars;
|
||||
current_ivars = 0;
|
||||
(void) ($<class>1);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -1506,16 +1509,18 @@ methoddef
|
|||
}
|
||||
opt_state_expr
|
||||
{ $<op>$ = current_storage; }
|
||||
{ $<string_val>$ = method_name ($2); }
|
||||
{
|
||||
$<def>$ = $2->def = method_def (current_class, $2);
|
||||
current_params = $2->params;
|
||||
}
|
||||
begin_function statement_block { $<op>$ = $<op>5; } end_function
|
||||
{
|
||||
$2->func = build_code_function ($7, $4, $8);
|
||||
$2->func = build_code_function ($8, $4, $9);
|
||||
current_func = 0;
|
||||
(void) ($<method>6);
|
||||
(void) ($<op>9);
|
||||
(void) ($<string_val>6);
|
||||
(void) ($<def>7);
|
||||
(void) ($<op>10);
|
||||
}
|
||||
| ci methoddecl
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue