From 61531e58066e4d803624ab2c6dac84445fb75e59 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 30 Jul 2026 00:20:30 -0400 Subject: casting --- codegen.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'codegen.c') diff --git a/codegen.c b/codegen.c index 6d55d2c..5cba20f 100644 --- a/codegen.c +++ b/codegen.c @@ -515,12 +515,13 @@ static void emit_expr_list( emit_expr(outfile, node->expr, node->next == NULL ? dst : NULL); } -static void emit_paren( +static void emit_cast( FILE* outfile, - const struct paren_node* node, + const struct cast_node* node, const struct lval_def* dst ) { - emit_expr_list(outfile, node->expr_list, dst); + /* TODO: for anything but a reinterpret cast this is garbage */ + emit_expr(outfile, node->expr, dst); } static void emit_expr( @@ -557,7 +558,10 @@ static void emit_expr( emit_binary(outfile, &node->inner.binary, dst); break; case EXPR_PAREN: - emit_paren(outfile, &node->inner.paren, dst); + emit_expr_list(outfile, node->inner.paren.expr_list, dst); + break; + case EXPR_CAST: + emit_cast(outfile, &node->inner.cast, dst); break; } } -- cgit v1.2.3