From 19acdd751963e88b6e75693f947b1b1fd2912f11 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 20 Aug 2022 06:31:06 +0200 Subject: defer --- bootstrap/all.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'bootstrap/all.h') diff --git a/bootstrap/all.h b/bootstrap/all.h index 1bfe919..64ab9b1 100644 --- a/bootstrap/all.h +++ b/bootstrap/all.h @@ -38,6 +38,7 @@ struct span { _(const) \ _(continue) \ _(def) \ + _(defer) \ _(defmacro) \ _(do) \ _(else) \ @@ -125,6 +126,7 @@ struct parser { struct env *primenv; struct env *tlenv; struct env *curenv; + struct blockstmt *curblock; struct fn *curfn; struct expan { struct expan *prev; @@ -343,6 +345,7 @@ enum exprtype { struct blockstmt { struct env env; slice_t(struct stmt) stmts; + struct defer *defers; }; struct expr { @@ -475,7 +478,10 @@ struct stmt { struct blockstmt *f; bool byptr; } euswitch; - struct expr *retex; + struct { + struct expr *ex; + int deferage; + } ret; struct { int id; } brkcon; @@ -488,6 +494,11 @@ struct stmt { } cswitch; }; }; +struct defer { + struct defer *next; + int age; + struct expr ex; +} ; struct comfile { slice_t(struct decl *) decls; -- cgit v1.2.3