diff options
Diffstat (limited to 'typedefs_cgen.c')
-rw-r--r-- | typedefs_cgen.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/typedefs_cgen.c b/typedefs_cgen.c index e882419..08b582d 100644 --- a/typedefs_cgen.c +++ b/typedefs_cgen.c @@ -12,12 +12,19 @@ static bool typedefs_block(CGenerator *g, Block *b) { static bool typedefs_expr(CGenerator *g, Expression *e) { cgen_recurse_subexprs(g, e, typedefs_expr, typedefs_block); + if (e->kind == EXPR_FN) { + /* needs to go before decls_cgen.c... */ + e->fn.c.id = g->ident_counter++; + } return true; } static bool typedefs_decl(CGenerator *g, Declaration *d) { d->c.ids = NULL; + if (cgen_fn_is_direct(g, d)) { + d->expr.fn.c.name = d->idents[0]; + } for (int idx = 0; idx < (int)arr_len(d->idents); idx++) { Identifier i = d->idents[idx]; Type *type = decl_type_at_index(d, idx); |