aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/parse.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/parse.c
parent99cb50d4f13d587e3a0e0f2a44485f301409afb4 (diff)
more fix
Diffstat (limited to 'bootstrap/parse.c')
-rw-r--r--bootstrap/parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index 297f2a9..daf632d 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -2371,6 +2371,8 @@ parsefn(struct decl *decl, struct parser *P) {
struct tok tok;
struct fn *fn = &decl->fn;
const char *name = fn->name;
+ static int id;
+
memset(fn, 0, sizeof *fn);
fn->name = name;
@@ -2401,10 +2403,9 @@ parsefn(struct decl *decl, struct parser *P) {
fatal(P, tok.span, "return type is incomplete (%t)",
fn->retty);
}
+ fn->id = id++;
if (!lexmatch(P, &tok, ';')) {
struct env *env = xcalloc(1, sizeof *env);
- static int id;
- fn->id = id++;
lexexpect(P, '{');
env->parent = P->curenv;
@@ -2646,6 +2647,7 @@ parseagg(struct parser *P, const char *name, int kind, struct decl **retdecl) {
struct decl *decl = (struct decl *)envfind(&env_noparent, P->envage, name);
if (decl && decl->t == Dtype && decl->ty->t == kind) {
pty = decl->ty;
+ *(bool *)&pty->agg.fwd = 0;
} else {
pty = interntype((struct type) {
kind, .agg.name = name, .agg.id = id++