diff options
| -rw-r--r-- | bootstrap/parse.c | 1 | ||||
| -rw-r--r-- | src/parse.cff | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c index 99d317a..fd38860 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -2701,6 +2701,7 @@ parsefn(struct decl *decl, struct parser *P) { lexexpect(P, '{'); env->parent = P->curenv; + WITH_TMPCHANGE(struct blockstmt *, P->curblock, NULL) // do not inherit defers WITH_TMPCHANGE(struct fn *, P->curfn, fn) { pushenv(P, env); putdecl(P, tok.span, &(struct decl) { diff --git a/src/parse.cff b/src/parse.cff index 3512c96..e1b5f58 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -2610,7 +2610,10 @@ fn parsefn(P *Parser, loc Loc, toplevel bool, externp bool, name *const u8) *Dec } } with_tmpchange(P.alloc, &Allocator { &Arena {}, &Arena:allocf }) { + let block = P.curblock; + P.curblock = #null; Fn.body = :Some(parseblock(P)); + P.curblock = block; popenv(P); // ir_genfn(P.irctx, Fn); llvm_genfn(externp, name, Fn); |