aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/cgen.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-11 06:51:48 +0200
committerlemon <lsof@mailbox.org>2022-08-11 06:51:48 +0200
commit25bf34e2c15b93e1cedab14cc83dddbb08ffcf3b (patch)
tree5b57e1d11126a839851ef3038e61a524719b4bfc /bootstrap/cgen.c
parent99cb50d4f13d587e3a0e0f2a44485f301409afb4 (diff)
more fix
Diffstat (limited to 'bootstrap/cgen.c')
-rw-r--r--bootstrap/cgen.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c
index 4e4d53f..a00c08f 100644
--- a/bootstrap/cgen.c
+++ b/bootstrap/cgen.c
@@ -487,7 +487,6 @@ liftnestedex(struct expr *ex) {
liftnestedex(ex->get.lhs);
break;
case Emcall:
- liftdecl(container_of(ex->mcall.met, struct decl, fn));
for (int i = 0; i < ex->call.args.n; ++i)
liftnestedex(&ex->mcall.args.d[i]);
break;
@@ -507,6 +506,7 @@ lifttype(const struct type *ty) {
if (ty->t == TYstruct || ty->t == TYunion || ty->t == TYeunion)
for (int i = 0; i < ty->agg.decls.n; ++i)
liftdecl(ty->agg.decls.d[i]);
+
}
static void
@@ -514,11 +514,11 @@ liftdecl(struct decl *decl) {
static int id;
switch (decl->t) {
case Dfn:
- if (decl->fn.body) {
+ if (decl->fn.body || (decl->container && !decl->externp)) {
if (decl->container)
- *decl->_cname = xasprintf("__m%s_%s%d", decl->container->agg.name, decl->fn.name, id++);
+ *decl->_cname = xasprintf("__m%s_%s%d", decl->container->agg.name, decl->fn.name, decl->fn.id);
else
- *decl->_cname = xasprintf("__f%s_%d", decl->fn.name, id++);
+ *decl->_cname = xasprintf("__f%s_%d", decl->fn.name, decl->fn.id);
genfn(decl->externp, *decl->_cname, &decl->fn);
}
break;
@@ -533,8 +533,6 @@ liftdecl(struct decl *decl) {
liftnestedex(decl->var.ini);
break;
case Dtype:
- lifttype(decl->ty);
- break;
case Dtepl:
for (struct teplcache *cache = decl->tepl.cache; cache; cache = cache->next) {
for (int i = 0; i < cache->args.n; ++i) {