ox

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

commit c9a4c6ef2fd33b4c469c07f88759342ae389dd1f
parent b290a67e08f796d852ed959274848ee53771ea03
Author: citbl <citbl@citbl.org>
Date:   Sat,  1 Nov 2025 17:06:30 +1000

minor clean up

Diffstat:
Msrc/gen/gen.c | 25++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/gen/gen.c b/src/gen/gen.c @@ -58,13 +58,12 @@ current_continue(Gen* gen) return gen->loop ? gen->loop->continue_target : NULL; } -static const char* -get_english_type(gcc_jit_type* t) +__attribute__((unused)) static const char* +get_english_type(gcc_jit_type* T) { - gcc_jit_object* obj = gcc_jit_type_as_object(t); - const char* st = gcc_jit_object_get_debug_string(obj); - return st; + return gcc_jit_object_get_debug_string(gcc_jit_type_as_object(T)); } + Gen gen_init(Scope* scope, const char* src, Node* node, bool quiet) { @@ -608,6 +607,14 @@ static gcc_jit_rvalue* build_bool_value(Gen*, Node*); static int block_counter = 0, loop_counter = 0; static bool +build_call_expression(Gen* gen, Node* node) +{ + 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; +} + +static bool build_for_statement(Gen* gen, Node* node) { gcc_jit_location* loc = loc_from_node(gen, node); @@ -798,8 +805,6 @@ build_statement(Gen* gen, Node* node) { gcc_jit_location* loc = loc_from_node(gen, node); switch (node->type) { - case NODE_BLOCK: - break; case NODE_RETURN: { gcc_jit_rvalue* rv = handle_expr(gen, node->data.ret.expr); gcc_jit_block_end_with_return(gen->curr_block, loc, rv); @@ -833,8 +838,8 @@ build_statement(Gen* gen, Node* node) gcc_jit_lvalue* lvalue = sym->d.lvalue; // check the type of lvalue matches the rvalue - gcc_jit_type* ltype = sym->ctype; - gcc_jit_type* rtype = gcc_jit_rvalue_get_type(rvalue); + // gcc_jit_type* ltype = sym->ctype; + // gcc_jit_type* rtype = gcc_jit_rvalue_get_type(rvalue); // if (rtype != ltype) { // panic_at(node, // "right hand side of assigment " @@ -876,6 +881,8 @@ build_statement(Gen* gen, Node* node) return build_if_statement(gen, node); case NODE_FOR: return build_for_statement(gen, node); + case NODE_CALL_EXPR: + return build_call_expression(gen, node); default: printf("build_statement unhandled, %s\n", node_type_str(node->type)); break;