ox

The Ox programming language, compiler and tools (WIP)
Log | Files | Refs | README | LICENSE

commit 110645e2491b7a531c0bea47f74e0c66e77a307e
parent e23a867178b73c4060a19364dc528f1588f09964
Author: citbl <citbl@citbl.org>
Date:   Sun,  9 Nov 2025 13:29:32 +1000

minor cleanups

Diffstat:
Msrc/gen/gen.c | 28++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/gen/gen.c b/src/gen/gen.c @@ -506,11 +506,6 @@ lower_builtin_print(Gen* gen, Node* node) static gcc_jit_function* lookup_function(Gen* gen, const char* func_name) { - // callee node which contains an ident - // args list which contains args with len and cap - - // TODO impl @next lookup function after maybe reworking the symbols table - // gen->scope..symbols for (size_t i = 0; i < gen->scope->len; i++) { Symbol* sym = gen->scope->symbols[i]; @@ -531,24 +526,21 @@ handle_func_call(Gen* gen, Node* node) const char* func_name = span_str(gen->src, fcallee->data.ident.name, (char[IDENTSZ]) { 0 }); if (strcmp(func_name, "print") == 0) return lower_builtin_print(gen, node); - // softpanic("unhandled func call named: %s", func_name); - - // almost unrelated could be useful to deal with return values: - // gcc_jit_rvalue* rv = handle_func_call(gen, node); - // if (rv) { gcc_jit_block_add_eval(gen->curr_block, loc_from_node(gen, node), rv); } - // return false; - - // - // TODO handle any function other than print... - // - // int argc = node->data.call_expr.len; - gcc_jit_function* callee = lookup_function(gen, func_name); - return gcc_jit_context_new_call(gen->ctx, NULL, callee, 0, NULL); + // TODO handle args // gcc_jit_rvalue* args[16]; // @future fixed at 16 parameters in call // for (int i = 0; i < argc; i++) { // args[i] = handle_expr(gen, node->data.call_expr.args[i]); // } // return gcc_jit_context_new_call(gen->ctx, NULL, callee, argc, args); + + gcc_jit_function* callee = lookup_function(gen, func_name); + return gcc_jit_context_new_call(gen->ctx, NULL, callee, 0, NULL); + + // TODO handle return values + // almost unrelated could be useful to deal with return values: + // gcc_jit_rvalue* rv = handle_func_call(gen, node); + // if (rv) { gcc_jit_block_add_eval(gen->curr_block, loc_from_node(gen, node), rv); } + // return false; return NULL; }