aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/cgen.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-11 07:41:58 +0200
committerlemon <lsof@mailbox.org>2022-08-11 07:41:58 +0200
commit09ebbe187819f54b514db79c4382c26cda425250 (patch)
tree38a9c7b61ed47f3afebb92958adfa9f1094e1683 /bootstrap/cgen.c
parent25bf34e2c15b93e1cedab14cc83dddbb08ffcf3b (diff)
finally?
Diffstat (limited to 'bootstrap/cgen.c')
-rw-r--r--bootstrap/cgen.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c
index a00c08f..9053331 100644
--- a/bootstrap/cgen.c
+++ b/bootstrap/cgen.c
@@ -487,7 +487,8 @@ liftnestedex(struct expr *ex) {
liftnestedex(ex->get.lhs);
break;
case Emcall:
- for (int i = 0; i < ex->call.args.n; ++i)
+ liftdecl(container_of(ex->mcall.met, struct decl, fn));
+ for (int i = 0; i < ex->mcall.args.n; ++i)
liftnestedex(&ex->mcall.args.d[i]);
break;
case Eslice:
@@ -600,9 +601,12 @@ liftnested(struct stmt *stmt) {
}
}
+static void defctype(const struct type *ty, void *_);
+
static void
genfn(bool externp, const char *cname, struct fn *fn) {
liftnested(fn->body);
+ defctype(fn->retty,NULL);
if (!externp)
pri("static ");
pri("%t %s(", fn->retty, cname);
@@ -734,7 +738,6 @@ defctype(const struct type *ty, void *_) {
pri("_Static_assert(__alignof__(%s) == %U, \"__alignof__(%t) == %U\");\n",
*cname, (u64)ty->align, ty, (u64)ty->align);
}
- lifttype(ty);
break;
case TYeunion:
if (ty->konst) {
@@ -759,7 +762,6 @@ defctype(const struct type *ty, void *_) {
pri("_Static_assert(__alignof__(%s) == %U, \"__alignof__(%t) == %U\");\n",
*cname, (u64)ty->align, ty, (u64)ty->align);
}
- lifttype(ty);
break;
}