Aria

A low-level systems programming language
git clone git://git.m21c.me/Aria.git
Log | Files | Refs | README | LICENSE

commit c19e4eadc9818ab2b659bb227e5aa67286f3bbd3
parent cf8cdc2d711c0e44970a2d3a32c6aafa1f1717ee
Author: m21c <ho*******@gmail.com>
Date:   Tue, 23 Jun 2026 05:15:52 +0200

codegen: make prototypes of functions inside record

Diffstat:
Mcompiler.c | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/compiler.c b/compiler.c @@ -6376,6 +6376,15 @@ cgtype(CodeGen *cg, Type *type, Decl *decl) Type *post[64]; int top = 0, pcount = 0; + if ((cg->env->kind == SSTRUCT + || cg->env->kind == SUNION) + && type->kind == TFUNCTION) { + assert(top < lengthof(stack)); + stack[top++] = maketype( + cg->env->arenas, &decl->loc, + primitive(TPTR), type); + } + while (type->target || type->kind == TFUNCTION) { assert(top < lengthof(stack)); stack[top++] = type; @@ -6398,7 +6407,7 @@ decorate: Type *curr = stack[--top]; if (curr->kind == TPTR) { Type *target = curr->target; - if (target->kind != TPTR && target->target) { + if (target->kind != TPTR && (target->target || target->u.rtarget)) { cgprintf(cg, "(*"); assert(pcount < lengthof(post)); post[pcount++] = curr;