mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 01:42:04 +00:00
[qfcc] Add partial support for renamed builtins
The back-end support for renamed builtins (fte's = #0:name) was needed for pascal functions because the internal name is now prefixed with an @ to allow the lvalue/rvalue selection of behavior for function symbols
This commit is contained in:
parent
27c3ee4c39
commit
4a8c53aa6f
4 changed files with 11 additions and 8 deletions
|
@ -217,7 +217,7 @@ function_t *begin_function (symbol_t *sym, const char *nicename,
|
|||
enum storage_class_e storage);
|
||||
function_t *build_code_function (symbol_t *fsym,
|
||||
const expr_t *state_expr, expr_t *statements);
|
||||
function_t *build_builtin_function (symbol_t *sym,
|
||||
function_t *build_builtin_function (symbol_t *sym, const char *ext_name,
|
||||
const expr_t *bi_val, int far,
|
||||
enum storage_class_e storage);
|
||||
void build_intrinsic_function (specifier_t spec, const expr_t *intrinsic);
|
||||
|
|
|
@ -1194,8 +1194,8 @@ build_code_function (symbol_t *fsym, const expr_t *state_expr,
|
|||
}
|
||||
|
||||
function_t *
|
||||
build_builtin_function (symbol_t *sym, const expr_t *bi_val, int far,
|
||||
storage_class_t storage)
|
||||
build_builtin_function (symbol_t *sym, const char *ext_name,
|
||||
const expr_t *bi_val, int far, storage_class_t storage)
|
||||
{
|
||||
int bi;
|
||||
|
||||
|
@ -1219,7 +1219,10 @@ build_builtin_function (symbol_t *sym, const expr_t *bi_val, int far,
|
|||
}
|
||||
|
||||
defspace_t *space = far ? pr.far_data : sym->table->space;
|
||||
func = make_function (sym, 0, space, storage);
|
||||
func = make_function (sym, nullptr, space, storage);
|
||||
if (ext_name) {
|
||||
func->s_name = ReuseString (ext_name);
|
||||
}
|
||||
|
||||
if (func->def->external)
|
||||
return 0;
|
||||
|
|
|
@ -833,7 +833,7 @@ qc_nocode_func
|
|||
|
||||
spec.is_overload |= ctx->language->always_overload;
|
||||
symbol_t *sym = function_symbol (spec);
|
||||
build_builtin_function (sym, bi_val, 0, spec.storage);
|
||||
build_builtin_function (sym, nullptr, bi_val, 0, spec.storage);
|
||||
}
|
||||
| identifier '=' intrinsic
|
||||
{
|
||||
|
@ -1204,7 +1204,7 @@ function_body
|
|||
|
||||
spec.is_overload |= ctx->language->always_overload;
|
||||
symbol_t *sym = function_symbol (spec);
|
||||
build_builtin_function (sym, bi_val, 0, spec.storage);
|
||||
build_builtin_function (sym, nullptr, bi_val, 0, spec.storage);
|
||||
}
|
||||
| '=' intrinsic
|
||||
{
|
||||
|
@ -2649,7 +2649,7 @@ methoddef
|
|||
method->instance = $1;
|
||||
method = class_find_method (current_class, method);
|
||||
sym = method_symbol (current_class, method);
|
||||
build_builtin_function (sym, bi_val, 1, sc_static);
|
||||
build_builtin_function (sym, nullptr, bi_val, 1, sc_static);
|
||||
method->func = sym->metafunc->func;
|
||||
method->def = method->func->def;
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ subprogram_declaration
|
|||
// always an sy_xvalue with callable symbol in lvalue and
|
||||
// actual function symbol in rvalue
|
||||
auto fsym = (symbol_t *) sym->xvalue.rvalue;
|
||||
build_builtin_function (fsym, $4, 0, current_storage);
|
||||
build_builtin_function (fsym, sym->name, $4, 0, current_storage);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue