From 5d1a8971af0cca01084f370be47f4be910cbf712 Mon Sep 17 00:00:00 2001 From: Victor Borja Date: Mon, 9 Nov 2026 06:18:44 -0600 Subject: [PATCH] effects: handler rows (E1b). A handler is one subject of the effect rows: what its ops request comes from the handlers outside its handle (deep handlers), captured when the handle runs. The handle site keeps the capabilities in an env next to the state; the vtable points to wrappers that pass them --- bootstrap/s2c-seed.c | 69 +++++++++++------- s2/eff.srs | 24 +++++-- s2/elab.srs | 3 +- s2/emit.srs | 113 ++++++++++++++++++++++++++---- s2/mono.srs | 2 +- s2/pure.srs | 10 +-- s2/types.srs | 20 +++--- tests/s2/neg/eff_handler_row.srs | 16 +++++ tests/s2/prog/eff_handler_row.out | 3 + tests/s2/prog/eff_handler_row.srs | 29 ++++++++ tests/s2/types.srs | 4 +- 11 files changed, 232 insertions(+), 61 deletions(-) create mode 100644 tests/s2/neg/eff_handler_row.srs create mode 100644 tests/s2/prog/eff_handler_row.out create mode 100644 tests/s2/prog/eff_handler_row.srs diff --git a/bootstrap/s2c-seed.c b/bootstrap/s2c-seed.c index 970d54c5..89bee771 100644 --- a/bootstrap/s2c-seed.c +++ b/bootstrap/s2c-seed.c @@ -4,6 +4,7 @@ #include typedef struct { const uint8_t* p; int64_t n; } srs_str; typedef struct { void* self; void* const* vt; int64_t live; } srs_cap; +typedef struct { void* st; srs_cap* c[]; } srs_env; void rt_init(int argc, char** argv); struct E_Coll__List__K__Term; struct E_K__Term; @@ -160,12 +161,12 @@ struct E_Ty__FnEx; struct E_Ty__Fns; struct E_Ty__Ex; struct E_Ty__Es; +struct E_Ty__Caps; struct E_Ty__AEx; struct E_Ty__Open; struct E_Coll__Option__Ty__TM; struct E_Ty__TM; struct E_Coll__Option__Ast__Op; -struct E_Ty__Caps; struct E_Eff__Req; struct E_Coll__Option__Eff__Req; struct E_Ty__At; @@ -424,16 +425,16 @@ struct E_Coll__List__Coll__SEntry_1_Emit__CaseAt; struct E_Coll__SEntry__Emit__CaseAt; struct E_Emit__CaseAt; struct E_Coll__BTree__Coll__List_1_K__Term; -struct E_Emit__Fi; struct E_Coll__List__Emit__Slot; struct E_Emit__Slot; +struct E_Emit__Sep; +struct E_Emit__Fi; struct E_Coll__Option__Ast__Enum; struct E_Coll__Split__Coll__List_1_K__Term; struct E_Coll__List__Emit__Name; struct E_Emit__Name; struct E_Emit__Pos; struct E_Emit__Env; -struct E_Emit__Sep; struct E_Emit__Drop; struct E_Coll__List__Emit__Drop; struct E_Emit__Guard; @@ -586,7 +587,7 @@ struct E_El__Fn { int64_t tag; union { struct { int64_t f_line; struct E_Sym__Sy struct E_El__Body { int64_t tag; union { struct { struct E_El__Expr* f_e; } C_El__Def; struct { struct E_El__Expr* f_e; } C_El__Spec; int64_t none_; } u; }; struct E_El__Expr { int64_t tag; union { struct { int64_t f_line; int64_t f_v; } C_El__Int; struct { int64_t f_line; bool f_v; } C_El__Bool; struct { int64_t f_line; srs_str f_s; } C_El__Str; struct { int64_t f_line; } C_El__Unit; struct { int64_t f_line; struct E_Sym__Sym* f_x; } C_El__Local; struct { int64_t f_line; struct E_Sym__Sym* f_f; struct E_Coll__List__K__Term* f_targs; struct E_Coll__List__Sym__Sym* f_caps; struct E_Coll__List__El__Expr* f_args; } C_El__CallFn; struct { int64_t f_line; struct E_Sym__Sym* f_en; struct E_Coll__List__K__Term* f_targs; struct E_Sym__Sym* f_c; struct E_El__Alloc* f_at; struct E_Coll__List__El__Expr* f_args; } C_El__New; struct { int64_t f_line; struct E_Sym__Sym* f_en; struct E_Coll__List__K__Term* f_targs; struct E_Sym__Sym* f_c; } C_El__Nullary; struct { int64_t f_line; struct E_Sym__Sym* f_recv; struct E_K__Term* f_ty; struct E_Sym__Sym* f_op; struct E_Coll__List__El__Expr* f_args; } C_El__Op; struct { int64_t f_line; struct E_Ast__BinOp* f_op; struct E_El__Expr* f_l; struct E_El__Expr* f_rhs; } C_El__Bin; struct { int64_t f_line; struct E_Ast__UnOp* f_op; struct E_El__Expr* f_e; } C_El__Un; struct { int64_t f_line; struct E_El__Expr* f_c; struct E_El__Expr* f_t; struct E_El__Expr* f_e; } C_El__If; struct { int64_t f_line; struct E_El__Expr* f_s; struct E_K__Term* f_en; struct E_Coll__List__El__Arm* f_arms; } C_El__Match; struct { int64_t f_line; struct E_Coll__List__El__Stmt* f_stmts; struct E_El__Expr* f_last; } C_El__Block; struct { int64_t f_line; struct E_El__Expr* f_c; struct E_El__Expr* f_body; } C_El__While; struct { int64_t f_line; struct E_Sym__Sym* f_x; struct E_El__Expr* f_e; } C_El__Assign; struct { int64_t f_line; } C_El__Bad; int64_t none_; } u; }; struct E_Coll__List__El__Stmt { int64_t tag; union { struct { struct E_El__Stmt* f_h; struct E_Coll__List__El__Stmt* f_t; } C_Coll__Cons; int64_t none_; } u; }; -struct E_El__Stmt { int64_t tag; union { struct { int64_t f_line; struct E_Sym__Sym* f_x; struct E_K__Term* f_ty; bool f_mut; struct E_El__Expr* f_e; } C_El__Val; struct { int64_t f_line; struct E_Sym__Sym* f_x; struct E_Sym__Sym* f_h; struct E_Coll__List__El__Expr* f_args; } C_El__Handle; struct { struct E_El__Expr* f_e; } C_El__Do; int64_t none_; } u; }; +struct E_El__Stmt { int64_t tag; union { struct { int64_t f_line; struct E_Sym__Sym* f_x; struct E_K__Term* f_ty; bool f_mut; struct E_El__Expr* f_e; } C_El__Val; struct { int64_t f_line; struct E_Sym__Sym* f_x; struct E_Sym__Sym* f_h; struct E_Coll__List__Sym__Sym* f_caps; struct E_Coll__List__El__Expr* f_args; } C_El__Handle; struct { struct E_El__Expr* f_e; } C_El__Do; int64_t none_; } u; }; struct E_Coll__List__El__Expr { int64_t tag; union { struct { struct E_El__Expr* f_h; struct E_Coll__List__El__Expr* f_t; } C_Coll__Cons; int64_t none_; } u; }; struct E_Coll__List__El__Arm { int64_t tag; union { struct { struct E_El__Arm* f_h; struct E_Coll__List__El__Arm* f_t; } C_Coll__Cons; int64_t none_; } u; }; struct E_El__Arm { int64_t tag; union { struct { int64_t f_line; struct E_Ast__Pat* f_p; struct E_El__Expr* f_body; } C_El__Arm; int64_t none_; } u; }; @@ -658,12 +659,12 @@ struct E_Ty__FnEx { int64_t tag; union { struct { struct E_Ty__St* f_st; struct struct E_Ty__Fns { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_Coll__List__El__Fn* f_fs; struct E_Coll__List__El__Handler* f_hs; struct E_Coll__List__El__Given* f_gvs; } C_Ty__Fns; int64_t none_; } u; }; struct E_Ty__Ex { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_K__Term* f_t; struct E_El__Expr* f_e; } C_Ty__Ex; int64_t none_; } u; }; struct E_Ty__Es { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_Coll__List__El__Expr* f_es; } C_Ty__Es; int64_t none_; } u; }; +struct E_Ty__Caps { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_Coll__List__Sym__Sym* f_caps; } C_Ty__Caps; int64_t none_; } u; }; struct E_Ty__AEx { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_K__Term* f_t; struct E_El__Arm* f_a; } C_Ty__AEx; int64_t none_; } u; }; struct E_Ty__Open { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_Coll__List__Ty__Bind* f_tv; struct E_Coll__List__K__Term* f_vars; } C_Ty__Open; int64_t none_; } u; }; struct E_Coll__Option__Ty__TM { int64_t tag; union { struct { struct E_Ty__TM* f_v; } C_Coll__Some; int64_t none_; } u; }; struct E_Ty__TM { int64_t tag; union { struct { struct E_Ast__Trait* f_t; struct E_Ast__Fn* f_m; } C_Ty__TM; int64_t none_; } u; }; struct E_Coll__Option__Ast__Op { int64_t tag; union { struct { struct E_Ast__Op* f_v; } C_Coll__Some; int64_t none_; } u; }; -struct E_Ty__Caps { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_Coll__List__Sym__Sym* f_caps; } C_Ty__Caps; int64_t none_; } u; }; struct E_Eff__Req { int64_t tag; union { struct { struct E_Sym__Sym* f_p; struct E_Sym__Sym* f_op; } C_Eff__Req; int64_t none_; } u; }; struct E_Coll__Option__Eff__Req { int64_t tag; union { struct { struct E_Eff__Req* f_v; } C_Coll__Some; int64_t none_; } u; }; struct E_Ty__At { int64_t tag; union { struct { struct E_Ty__St* f_st; struct E_K__Term* f_t; } C_Ty__At; int64_t none_; } u; }; @@ -922,16 +923,16 @@ struct E_Coll__List__Coll__SEntry_1_Emit__CaseAt { int64_t tag; union { struct { struct E_Coll__SEntry__Emit__CaseAt { int64_t tag; union { struct { struct E_Sym__Sym* f_s; struct E_Emit__CaseAt* f_v; } C_Coll__SEntry; int64_t none_; } u; }; struct E_Emit__CaseAt { int64_t tag; union { struct { int64_t f_tag; struct E_Ast__Enum* f_en; struct E_Ast__Case* f_c; } C_Emit__CaseAt; int64_t none_; } u; }; struct E_Coll__BTree__Coll__List_1_K__Term { int64_t tag; union { struct { struct E_Coll__BTree__Coll__List_1_K__Term* f_a; int64_t f_k1; struct E_Coll__List__K__Term* f_v1; struct E_Coll__BTree__Coll__List_1_K__Term* f_b; } C_Coll__B2; struct { struct E_Coll__BTree__Coll__List_1_K__Term* f_a; int64_t f_k1; struct E_Coll__List__K__Term* f_v1; struct E_Coll__BTree__Coll__List_1_K__Term* f_b; int64_t f_k2; struct E_Coll__List__K__Term* f_v2; struct E_Coll__BTree__Coll__List_1_K__Term* f_c; } C_Coll__B3; struct { struct E_Coll__BTree__Coll__List_1_K__Term* f_a; int64_t f_k1; struct E_Coll__List__K__Term* f_v1; struct E_Coll__BTree__Coll__List_1_K__Term* f_b; int64_t f_k2; struct E_Coll__List__K__Term* f_v2; struct E_Coll__BTree__Coll__List_1_K__Term* f_c; int64_t f_k3; struct E_Coll__List__K__Term* f_v3; struct E_Coll__BTree__Coll__List_1_K__Term* f_d; } C_Coll__B4; int64_t none_; } u; }; -struct E_Emit__Fi { int64_t tag; union { struct { struct E_Sym__Sym* f_self; struct E_Coll__List__K__Term* f_targs; struct E_Coll__List__Ty__Bind* f_sub; struct E_Coll__List__Emit__Slot* f_slots; struct E_K__Term* f_ret; } C_Emit__Fi; int64_t none_; } u; }; struct E_Coll__List__Emit__Slot { int64_t tag; union { struct { struct E_Emit__Slot* f_h; struct E_Coll__List__Emit__Slot* f_t; } C_Coll__Cons; int64_t none_; } u; }; struct E_Emit__Slot { int64_t tag; union { struct { struct E_Sym__Sym* f_x; } C_Emit__SCap; struct { struct E_Sym__Sym* f_x; struct E_K__Term* f_t; } C_Emit__SVal; int64_t none_; } u; }; +struct E_Emit__Sep { int64_t tag; union { int64_t none_; } u; }; +struct E_Emit__Fi { int64_t tag; union { struct { struct E_Sym__Sym* f_self; struct E_Coll__List__K__Term* f_targs; struct E_Coll__List__Ty__Bind* f_sub; struct E_Coll__List__Emit__Slot* f_slots; struct E_K__Term* f_ret; } C_Emit__Fi; int64_t none_; } u; }; struct E_Coll__Option__Ast__Enum { int64_t tag; union { struct { struct E_Ast__Enum* f_v; } C_Coll__Some; int64_t none_; } u; }; struct E_Coll__Split__Coll__List_1_K__Term { int64_t tag; union { struct { struct E_Coll__BTree__Coll__List_1_K__Term* f_l; int64_t f_k; struct E_Coll__List__K__Term* f_v; struct E_Coll__BTree__Coll__List_1_K__Term* f_r; } C_Coll__Split; int64_t none_; } u; }; struct E_Coll__List__Emit__Name { int64_t tag; union { struct { struct E_Emit__Name* f_h; struct E_Coll__List__Emit__Name* f_t; } C_Coll__Cons; int64_t none_; } u; }; struct E_Emit__Name { int64_t tag; union { struct { struct E_Sym__Sym* f_x; } C_Emit__P; struct { struct E_Sym__Sym* f_x; int64_t f_n; } C_Emit__L; int64_t none_; } u; }; struct E_Emit__Pos { int64_t tag; union { int64_t none_; } u; }; struct E_Emit__Env { int64_t tag; union { struct { struct E_Coll__List__Emit__Name* f_vs; int64_t f_n; } C_Emit__Env; int64_t none_; } u; }; -struct E_Emit__Sep { int64_t tag; union { int64_t none_; } u; }; struct E_Emit__Drop { int64_t tag; union { struct { struct E_Emit__Name* f_c; struct E_Sym__Sym* f_proto; } C_Emit__Drop; int64_t none_; } u; }; struct E_Coll__List__Emit__Drop { int64_t tag; union { struct { struct E_Emit__Drop* f_h; struct E_Coll__List__Emit__Drop* f_t; } C_Coll__Cons; int64_t none_; } u; }; struct E_Emit__Guard { int64_t tag; union { struct { int64_t f_tag; } C_Emit__Tag; int64_t none_; } u; }; @@ -1393,12 +1394,12 @@ static struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Emit__CaseAt N_Coll__BT static struct E_Coll__List__Coll__SEntry_1_Emit__CaseAt N_Coll__Nil__Coll__SEntry_1_Emit__CaseAt = { 0, { 0 } }; static struct E_Coll__BTree__Coll__List_1_K__Term N_Coll__BTip__Coll__List_1_K__Term = { 0, { 0 } }; static struct E_Coll__List__Emit__Slot N_Coll__Nil__Emit__Slot = { 0, { 0 } }; +static struct E_Emit__Sep N_Emit__First = { 0, { 0 } }; +static struct E_Emit__Sep N_Emit__Comma = { 1, { 0 } }; static struct E_Coll__Option__Ast__Enum N_Coll__None__Ast__Enum = { 0, { 0 } }; static struct E_Coll__List__Emit__Name N_Coll__Nil__Emit__Name = { 0, { 0 } }; static struct E_Emit__Pos N_Emit__Tail = { 0, { 0 } }; static struct E_Emit__Pos N_Emit__Inner = { 1, { 0 } }; -static struct E_Emit__Sep N_Emit__First = { 0, { 0 } }; -static struct E_Emit__Sep N_Emit__Comma = { 1, { 0 } }; static struct E_Coll__List__Emit__Drop N_Coll__Nil__Emit__Drop = { 0, { 0 } }; static struct E_Emit__Guard N_Emit__Always = { 0, { 0 } }; static struct E_Coll__Option__Emit__CaseAt N_Coll__None__Emit__CaseAt = { 0, { 0 } }; @@ -1825,7 +1826,8 @@ static struct E_Coll__Option__Bool* f_Coll__sLookup__Bool(srs_cap* p_r, struct E static struct E_Coll__Option__Bool* f_Coll__sFind__Bool(srs_cap* p_r, struct E_Coll__List__Coll__SEntry_1_Bool* p_xs, struct E_Sym__Sym* p_s); static struct E_Coll__List__Coll__SEntry_1_Bool* f_Coll__bTGetOr__Coll__List_1_Coll__SEntry_1_Bool(struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Bool* p_t, int64_t p_k, struct E_Coll__List__Coll__SEntry_1_Bool* p_d); static struct E_Coll__List__D__Fact* f_Eff__decls(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__W* p_w); -static struct E_Eff__W* f_Eff__fn(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Ast__Fn* p_f, struct E_Eff__W* p_w); +static struct E_Eff__W* f_Eff__fn(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_n, struct E_Ast__Fn* p_f, struct E_Eff__W* p_w); +static struct E_Eff__W* f_Eff__hfns(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_h, struct E_Coll__List__Ast__Fn* p_fs, struct E_Eff__W* p_w); static struct E_Eff__W* f_Eff__declsOf(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_f, struct E_Coll__List__Ast__Binder* p_bs, struct E_Eff__W* p_w); static struct E_Eff__W* f_Eff__req(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Sym__Sym* p_p, struct E_Eff__W* p_w); static struct E_Eff__W* f_Eff__call(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Sym__Sym* p_g, struct E_Eff__W* p_w); @@ -2013,6 +2015,8 @@ static struct E_Coll__List__Coll__SEntry_1_El__Fn* f_Coll__bTGetOr__Coll__List_1 static int64_t f_Emit__defName(srs_cap* p_eff__Console, struct E_Sym__Sym* p_f, struct E_Coll__List__K__Term* p_ts); static int64_t f_Emit__sep(srs_cap* p_eff__Console, struct E_Emit__Sep* p_s); static int64_t f_Emit__capArgs(srs_cap* p_eff__Console, struct E_Emit__Env* p_env, struct E_Coll__List__Sym__Sym* p_caps, struct E_Emit__Sep* p_s); +static int64_t f_Emit__initCall(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Sym__Sym* p_h, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args); +static int64_t f_Emit__handleEnv(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Emit__Name* p_v, struct E_Sym__Sym* p_h, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args); static int64_t f_Emit__args(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__El__Expr* p_xs, struct E_Emit__Sep* p_s); static int64_t f_Emit__jump(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args); static int64_t f_Emit__temps(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__Emit__Slot* p_slots, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args, int64_t p_i); @@ -2098,7 +2102,12 @@ static int64_t f_Emit__bodies(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Em static int64_t f_Emit__handlers(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__El__Handler* p_hs, struct E_Emit__Part* p_what); static int64_t f_Emit__implFns(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Kind* p_k, struct E_Coll__List__El__Fn* p_fs, struct E_Emit__Part* p_what); static int64_t f_Emit__vtables(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__El__Handler* p_hs); -static int64_t f_Emit__vtOps(srs_cap* p_eff__Console, struct E_Sym__Sym* p_hn, struct E_Coll__List__Ast__Op* p_ops); +static bool f_Emit__hasRow(struct E_Coll__List__El__Fn* p_fs); +static int64_t f_Emit__wrappers(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Sym__Sym* p_hn, struct E_Coll__List__El__Fn* p_fs); +static struct E_Coll__List__Emit__Slot* f_Emit__opSlots(struct E_Coll__List__Emit__Slot* p_slots); +static int64_t f_Emit__envCaps(srs_cap* p_eff__Console, int64_t p_i, int64_t p_n); +static int64_t f_Emit__slotArgs(srs_cap* p_eff__Console, struct E_Coll__List__Emit__Slot* p_slots); +static int64_t f_Emit__vtOps(srs_cap* p_eff__Console, srs_str p_pre, struct E_Sym__Sym* p_hn, struct E_Coll__List__Ast__Op* p_ops); static int64_t f_Emit__allocFast(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx); static bool f_Emit__hasMain(srs_cap* p_r, struct E_Emit__Cx* p_cx); static int64_t f_Emit__program(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Coll__List__Ast__Decl* p_ds, struct E_Ty__Result* p_res); @@ -2983,7 +2992,7 @@ static struct E_Coll__List__D__Fact* f_Pure__facts(srs_cap* p_r, struct E_Coll__ static struct E_Coll__List__Sym__Sym* f_Pure__protos(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__Sym__Sym* p_acc); static struct E_Coll__SMap__Sym__Sym* f_Pure__hprotos(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__SMap__Sym__Sym* p_m); static struct E_Coll__List__D__Fact* f_Pure__decls(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Eff__Rows* p_rows, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__D__Fact* p_acc); -static struct E_Coll__List__D__Fact* f_Pure__rowUses(srs_cap* p_r, struct E_Sym__Sym* p_f, struct E_Coll__List__Eff__Cap* p_cs, struct E_Coll__List__D__Fact* p_acc); +static struct E_Coll__List__D__Fact* f_Pure__rowUses(srs_cap* p_r, struct E_Pure__Who* p_w, struct E_Coll__List__Eff__Cap* p_cs, struct E_Coll__List__D__Fact* p_acc); static struct E_Coll__List__D__Fact* f_Pure__fns(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Pure__Who* p_w, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__D__Fact* p_acc); static struct E_Coll__List__D__Fact* f_Pure__fn(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Pure__Who* p_w, struct E_Ast__Fn* p_f, struct E_Coll__List__D__Fact* p_acc); static struct E_Pure__Ev* f_Pure__binders(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Pure__Who* p_w, struct E_Coll__List__Ast__Binder* p_bs, struct E_Coll__List__Sym__Sym* p_ev, struct E_Coll__List__D__Fact* p_acc); @@ -3175,7 +3184,7 @@ static struct E_Coll__List__El__Given* f_Coll__rev__El__Given(srs_cap* p_r, stru static struct E_Coll__List__El__Given* f_Coll__revOnto__El__Given(srs_cap* p_r, struct E_Coll__List__El__Given* p_xs, struct E_Coll__List__El__Given* p_acc); static struct E_Coll__List__Ast__Fn* f_Ty__underGroups(srs_cap* p_r, struct E_Coll__List__Ast__Group* p_gs, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__Ast__Fn* p_acc); static struct E_Coll__List__Sym__Sym* f_Ty__binderNames(srs_cap* p_r, struct E_Coll__List__Ast__Binder* p_bs, struct E_Coll__List__Sym__Sym* p_acc); -static struct E_Ty__Fns* f_Ty__fnsEl(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__El__Fn* p_acc); +static struct E_Ty__Fns* f_Ty__fnsEl(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__Eff__Cap* p_row, struct E_Coll__List__El__Fn* p_acc); static struct E_Coll__List__Ty__Clash* f_Ty__unsolved(srs_cap* p_r, struct E_Coll__IMap__K__Term* p_s, struct E_Coll__List__Ty__Inst* p_is, struct E_Coll__List__Ty__Clash* p_cs); static bool f_Ty__ground(srs_cap* p_r, struct E_Coll__IMap__K__Term* p_s, struct E_Coll__List__K__Term* p_ts); static bool f_Ty__groundT(struct E_K__Term* p_t); @@ -3613,7 +3622,7 @@ static struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Sym__Sym* f_Coll__bRoot static struct E_D__Atom* f_Eff__atom(srs_cap* p_r, struct E_Eff__Rel* p_rel, struct E_Coll__List__I64* p_xs) { return ({ struct E_D__Atom* o0 = (struct E_D__Atom*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Atom, u) + sizeof(((struct E_D__Atom*)0)->u.C_D__Atom))); o0->tag = 0; o0->u.C_D__Atom.f_rel = f_Eff__relSym(p_r, p_rel); o0->u.C_D__Atom.f_args = f_Pure__vars(p_r, p_xs); o0; }); } static struct E_Coll__List__D__Rule* f_Eff__rules(srs_cap* p_r) { return ({ struct E_D__Rule* v_n1_0 = ({ struct E_D__Rule* o0 = (struct E_D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Rule, u) + sizeof(((struct E_D__Rule*)0)->u.C_D__Rule))); o0->tag = 0; o0->u.C_D__Rule.f_head = f_Eff__atom(p_r, (&N_Eff__RNeeds), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o0->u.C_D__Rule.f_body = ({ struct E_Coll__List__D__Lit* o0 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o0->tag = 1; o0->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o0 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Pos))); o0->tag = 0; o0->u.C_D__Pos.f_a = f_Eff__atom(p_r, (&N_Eff__RReq), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o0; }); o0->u.C_Coll__Cons.f_t = (&N_Coll__Nil__D__Lit); o0; }); o0; }); struct E_D__Rule* v_n2_1 = ({ struct E_D__Rule* o1 = (struct E_D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Rule, u) + sizeof(((struct E_D__Rule*)0)->u.C_D__Rule))); o1->tag = 0; o1->u.C_D__Rule.f_head = f_Eff__atom(p_r, (&N_Eff__RNeeds), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o1->u.C_D__Rule.f_body = ({ struct E_Coll__List__D__Lit* o1 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o1->tag = 1; o1->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o1 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Pos))); o1->tag = 0; o1->u.C_D__Pos.f_a = f_Eff__atom(p_r, (&N_Eff__RDecl), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o1; }); o1->u.C_Coll__Cons.f_t = (&N_Coll__Nil__D__Lit); o1; }); o1; }); struct E_D__Lit* v_callsA_2 = ({ struct E_D__Lit* o2 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Pos))); o2->tag = 0; o2->u.C_D__Pos.f_a = ({ struct E_D__Atom* o2 = (struct E_D__Atom*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Atom, u) + sizeof(((struct E_D__Atom*)0)->u.C_D__Atom))); o2->tag = 0; o2->u.C_D__Atom.f_rel = f_Eff__relSym(p_r, (&N_Eff__RCalls)); o2->u.C_D__Atom.f_args = f_Pure__vars(p_r, ({ struct E_Coll__List__I64* o2 = (struct E_Coll__List__I64*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__I64, u) + sizeof(((struct E_Coll__List__I64*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = ((int64_t)0); o2->u.C_Coll__Cons.f_t = f_Pure__two(p_r, ((int64_t)2), ((int64_t)3)); o2; })); o2; }); o2; }); struct E_D__Rule* v_n3_3 = ({ struct E_D__Rule* o3 = (struct E_D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Rule, u) + sizeof(((struct E_D__Rule*)0)->u.C_D__Rule))); o3->tag = 0; o3->u.C_D__Rule.f_head = f_Eff__atom(p_r, (&N_Eff__RNeeds), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o3->u.C_D__Rule.f_body = ({ struct E_Coll__List__D__Lit* o3 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = v_callsA_2; o3->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Lit* o3 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o3 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Pos))); o3->tag = 0; o3->u.C_D__Pos.f_a = f_Eff__atom(p_r, (&N_Eff__RNeeds), f_Pure__two(p_r, ((int64_t)2), ((int64_t)1))); o3; }); o3->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Lit* o3 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o3 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Neg))); o3->tag = 1; o3->u.C_D__Neg.f_a = f_Eff__atom(p_r, (&N_Eff__RHd), f_Pure__two(p_r, ((int64_t)3), ((int64_t)1))); o3; }); o3->u.C_Coll__Cons.f_t = (&N_Coll__Nil__D__Lit); o3; }); o3; }); o3; }); o3; }); struct E_D__Rule* v_w1_4 = ({ struct E_D__Rule* o4 = (struct E_D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Rule, u) + sizeof(((struct E_D__Rule*)0)->u.C_D__Rule))); o4->tag = 0; o4->u.C_D__Rule.f_head = f_Eff__atom(p_r, (&N_Eff__RRow), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o4->u.C_D__Rule.f_body = ({ struct E_Coll__List__D__Lit* o4 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o4 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Pos))); o4->tag = 0; o4->u.C_D__Pos.f_a = f_Eff__atom(p_r, (&N_Eff__RNeeds), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o4; }); o4->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Lit* o4 = (struct E_Coll__List__D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Lit, u) + sizeof(((struct E_Coll__List__D__Lit*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = ({ struct E_D__Lit* o4 = (struct E_D__Lit*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Lit, u) + sizeof(((struct E_D__Lit*)0)->u.C_D__Neg))); o4->tag = 1; o4->u.C_D__Neg.f_a = f_Eff__atom(p_r, (&N_Eff__RDecl), f_Pure__two(p_r, ((int64_t)0), ((int64_t)1))); o4; }); o4->u.C_Coll__Cons.f_t = (&N_Coll__Nil__D__Lit); o4; }); o4; }); o4; }); __auto_type res_ = ({ struct E_Coll__List__D__Rule* o5 = (struct E_Coll__List__D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Rule, u) + sizeof(((struct E_Coll__List__D__Rule*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = v_n1_0; o5->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Rule* o5 = (struct E_Coll__List__D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Rule, u) + sizeof(((struct E_Coll__List__D__Rule*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = v_n2_1; o5->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Rule* o5 = (struct E_Coll__List__D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Rule, u) + sizeof(((struct E_Coll__List__D__Rule*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = v_n3_3; o5->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__D__Rule* o5 = (struct E_Coll__List__D__Rule*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Rule, u) + sizeof(((struct E_Coll__List__D__Rule*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = v_w1_4; o5->u.C_Coll__Cons.f_t = (&N_Coll__Nil__D__Rule); o5; }); o5; }); o5; }); o5; }); res_; }); } static struct E_Eff__Syms* f_Eff__syms(srs_cap* p_r) { return ({ struct E_Eff__Syms* o0 = (struct E_Eff__Syms*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Syms, u) + sizeof(((struct E_Eff__Syms*)0)->u.C_Eff__Syms))); o0->tag = 0; o0->u.C_Eff__Syms.f_req = f_Eff__relSym(p_r, (&N_Eff__RReq)); o0->u.C_Eff__Syms.f_decl = f_Eff__relSym(p_r, (&N_Eff__RDecl)); o0->u.C_Eff__Syms.f_calls = f_Eff__relSym(p_r, (&N_Eff__RCalls)); o0->u.C_Eff__Syms.f_hd = f_Eff__relSym(p_r, (&N_Eff__RHd)); o0->u.C_Eff__Syms.f_region = f_Sym__of(p_r, ((srs_str){(const uint8_t*)"Region", 6})); o0; }); } -static struct E_Eff__Cx* f_Eff__cxOf(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__Cx* p_cx) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_cx; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = p_cx; ({ __auto_type v_ps_2 = s2->u.C_Eff__Cx.f_ps; __auto_type v_hp_3 = s2->u.C_Eff__Cx.f_hp; __auto_type v_fns_4 = s2->u.C_Eff__Cx.f_fns; __auto_type v_ctors_5 = s2->u.C_Eff__Cx.f_ctors; __auto_type v_ss_6 = s2->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s7 = v_d_0; s7->tag == 2 ? ({ __auto_type v_p_7 = s7->u.C_Ast__DProto.f_p; ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o8 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o8->tag = 0; o8->u.C_Eff__Cx.f_ps = ({ struct E_Coll__List__Ast__Proto* o8 = (struct E_Coll__List__Ast__Proto*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ast__Proto, u) + sizeof(((struct E_Coll__List__Ast__Proto*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = v_p_7; o8->u.C_Coll__Cons.f_t = v_ps_2; o8; }); o8->u.C_Eff__Cx.f_hp = v_hp_3; o8->u.C_Eff__Cx.f_fns = v_fns_4; o8->u.C_Eff__Cx.f_ctors = v_ctors_5; o8->u.C_Eff__Cx.f_ss = v_ss_6; o8; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); }) : s7->tag == 3 ? ({ __auto_type v_h_7 = s7->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s8 = v_h_7; ({ __auto_type v_n_8 = s8->u.C_Ast__Handler.f_name; __auto_type v_p_9 = s8->u.C_Ast__Handler.f_proto; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o10 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o10->tag = 0; o10->u.C_Eff__Cx.f_ps = v_ps_2; o10->u.C_Eff__Cx.f_hp = f_Coll__sInsert__Sym__Sym(p_r, v_hp_3, v_n_8, v_p_9); o10->u.C_Eff__Cx.f_fns = v_fns_4; o10->u.C_Eff__Cx.f_ctors = v_ctors_5; o10->u.C_Eff__Cx.f_ss = v_ss_6; o10; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : s7->tag == 0 ? ({ __auto_type v_f_7 = s7->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s8 = v_f_7; ({ __auto_type v_n_8 = s8->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o9 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o9->tag = 0; o9->u.C_Eff__Cx.f_ps = v_ps_2; o9->u.C_Eff__Cx.f_hp = v_hp_3; o9->u.C_Eff__Cx.f_fns = f_Coll__sInsert__Eff__Callee(p_r, v_fns_4, v_n_8, f_Eff__calleeOf(p_r, v_f_7)); o9->u.C_Eff__Cx.f_ctors = v_ctors_5; o9->u.C_Eff__Cx.f_ss = v_ss_6; o9; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : s7->tag == 1 ? ({ __auto_type v_e_7 = s7->u.C_Ast__DEnum.f_e; ({ __auto_type res_ = ({ __auto_type s8 = v_e_7; ({ __auto_type v_cases_8 = s8->u.C_Ast__Enum.f_cases; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o9 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o9->tag = 0; o9->u.C_Eff__Cx.f_ps = v_ps_2; o9->u.C_Eff__Cx.f_hp = v_hp_3; o9->u.C_Eff__Cx.f_fns = v_fns_4; o9->u.C_Eff__Cx.f_ctors = f_Eff__ctorsOf(p_r, v_cases_8, v_ctors_5); o9->u.C_Eff__Cx.f_ss = v_ss_6; o9; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = p_cx; p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); }); }); res_; }); }); }); res_; }); }); }); } +static struct E_Eff__Cx* f_Eff__cxOf(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__Cx* p_cx) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_cx; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = p_cx; ({ __auto_type v_ps_2 = s2->u.C_Eff__Cx.f_ps; __auto_type v_hp_3 = s2->u.C_Eff__Cx.f_hp; __auto_type v_fns_4 = s2->u.C_Eff__Cx.f_fns; __auto_type v_ctors_5 = s2->u.C_Eff__Cx.f_ctors; __auto_type v_ss_6 = s2->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s7 = v_d_0; s7->tag == 2 ? ({ __auto_type v_p_7 = s7->u.C_Ast__DProto.f_p; ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o8 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o8->tag = 0; o8->u.C_Eff__Cx.f_ps = ({ struct E_Coll__List__Ast__Proto* o8 = (struct E_Coll__List__Ast__Proto*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ast__Proto, u) + sizeof(((struct E_Coll__List__Ast__Proto*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = v_p_7; o8->u.C_Coll__Cons.f_t = v_ps_2; o8; }); o8->u.C_Eff__Cx.f_hp = v_hp_3; o8->u.C_Eff__Cx.f_fns = v_fns_4; o8->u.C_Eff__Cx.f_ctors = v_ctors_5; o8->u.C_Eff__Cx.f_ss = v_ss_6; o8; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); }) : s7->tag == 3 ? ({ __auto_type v_h_7 = s7->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s8 = v_h_7; ({ __auto_type v_n_8 = s8->u.C_Ast__Handler.f_name; __auto_type v_p_9 = s8->u.C_Ast__Handler.f_proto; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o10 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o10->tag = 0; o10->u.C_Eff__Cx.f_ps = v_ps_2; o10->u.C_Eff__Cx.f_hp = f_Coll__sInsert__Sym__Sym(p_r, v_hp_3, v_n_8, v_p_9); o10->u.C_Eff__Cx.f_fns = f_Coll__sInsert__Eff__Callee(p_r, v_fns_4, v_n_8, (&N_Eff__Runs)); o10->u.C_Eff__Cx.f_ctors = v_ctors_5; o10->u.C_Eff__Cx.f_ss = v_ss_6; o10; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : s7->tag == 0 ? ({ __auto_type v_f_7 = s7->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s8 = v_f_7; ({ __auto_type v_n_8 = s8->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o9 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o9->tag = 0; o9->u.C_Eff__Cx.f_ps = v_ps_2; o9->u.C_Eff__Cx.f_hp = v_hp_3; o9->u.C_Eff__Cx.f_fns = f_Coll__sInsert__Eff__Callee(p_r, v_fns_4, v_n_8, f_Eff__calleeOf(p_r, v_f_7)); o9->u.C_Eff__Cx.f_ctors = v_ctors_5; o9->u.C_Eff__Cx.f_ss = v_ss_6; o9; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : s7->tag == 1 ? ({ __auto_type v_e_7 = s7->u.C_Ast__DEnum.f_e; ({ __auto_type res_ = ({ __auto_type s8 = v_e_7; ({ __auto_type v_cases_8 = s8->u.C_Ast__Enum.f_cases; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = ({ struct E_Eff__Cx* o9 = (struct E_Eff__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__Cx, u) + sizeof(((struct E_Eff__Cx*)0)->u.C_Eff__Cx))); o9->tag = 0; o9->u.C_Eff__Cx.f_ps = v_ps_2; o9->u.C_Eff__Cx.f_hp = v_hp_3; o9->u.C_Eff__Cx.f_fns = v_fns_4; o9->u.C_Eff__Cx.f_ctors = f_Eff__ctorsOf(p_r, v_cases_8, v_ctors_5); o9->u.C_Eff__Cx.f_ss = v_ss_6; o9; }); p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Eff__Cx* t2 = p_cx; p_r = t0; p_ds = t1; p_cx = t2; goto srs_tail; (struct E_Eff__Cx*){0}; }); }); }); res_; }); }); }); res_; }); }); }); } static struct E_Coll__SMap__Eff__Callee* f_Coll__sInsert__Eff__Callee(srs_cap* p_r, struct E_Coll__SMap__Eff__Callee* p_m, struct E_Sym__Sym* p_s, struct E_Eff__Callee* p_v) { return ({ __auto_type s0 = p_m; ({ __auto_type v_t_0 = s0->u.C_Coll__SMap.f_t; ({ int64_t v_h_1 = f_Sym__hash(p_s); struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* v_n_2 = f_Coll__bFind__Coll__List_1_Coll__SEntry_1_Eff__Callee(v_t_0, v_h_1); __auto_type res_ = (f_Coll__bIsNode__Coll__List_1_Coll__SEntry_1_Eff__Callee(v_n_2) ? ({ struct E_Coll__SMap__Eff__Callee* o3 = (struct E_Coll__SMap__Eff__Callee*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__SMap__Eff__Callee, u) + sizeof(((struct E_Coll__SMap__Eff__Callee*)0)->u.C_Coll__SMap))); o3->tag = 0; o3->u.C_Coll__SMap.f_t = f_Coll__bRep__Coll__List_1_Coll__SEntry_1_Eff__Callee(p_r, v_t_0, v_h_1, f_Coll__sSet__Eff__Callee(p_r, f_Coll__bValOr__Coll__List_1_Coll__SEntry_1_Eff__Callee(v_n_2, v_h_1, (&N_Coll__Nil__Coll__SEntry_1_Eff__Callee)), p_s, p_v)); o3; }) : ({ struct E_Coll__SMap__Eff__Callee* o3 = (struct E_Coll__SMap__Eff__Callee*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__SMap__Eff__Callee, u) + sizeof(((struct E_Coll__SMap__Eff__Callee*)0)->u.C_Coll__SMap))); o3->tag = 0; o3->u.C_Coll__SMap.f_t = f_Coll__bIns__Coll__List_1_Coll__SEntry_1_Eff__Callee(p_r, v_t_0, v_h_1, ({ struct E_Coll__List__Coll__SEntry_1_Eff__Callee* o3 = (struct E_Coll__List__Coll__SEntry_1_Eff__Callee*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Coll__SEntry_1_Eff__Callee, u) + sizeof(((struct E_Coll__List__Coll__SEntry_1_Eff__Callee*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = ({ struct E_Coll__SEntry__Eff__Callee* o3 = (struct E_Coll__SEntry__Eff__Callee*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__SEntry__Eff__Callee, u) + sizeof(((struct E_Coll__SEntry__Eff__Callee*)0)->u.C_Coll__SEntry))); o3->tag = 0; o3->u.C_Coll__SEntry.f_s = p_s; o3->u.C_Coll__SEntry.f_v = p_v; o3; }); o3->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Coll__SEntry_1_Eff__Callee); o3; })); o3; })); res_; }); }); }); } static struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* f_Coll__bFind__Coll__List_1_Coll__SEntry_1_Eff__Callee(struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* p_t, int64_t p_k) { srs_tail: return ({ __auto_type s0 = p_t; s0->tag == 0 ? ({ p_t; }) : s0->tag == 1 ? ({ __auto_type v_a_0 = s0->u.C_Coll__B2.f_a; __auto_type v_k1_1 = s0->u.C_Coll__B2.f_k1; __auto_type v_b_2 = s0->u.C_Coll__B2.f_b; ((p_k < v_k1_1) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_a_0; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k > v_k1_1) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_b_2; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : p_t)); }) : s0->tag == 2 ? ({ __auto_type v_a_0 = s0->u.C_Coll__B3.f_a; __auto_type v_k1_1 = s0->u.C_Coll__B3.f_k1; __auto_type v_b_2 = s0->u.C_Coll__B3.f_b; __auto_type v_k2_3 = s0->u.C_Coll__B3.f_k2; __auto_type v_c_4 = s0->u.C_Coll__B3.f_c; ({ __auto_type res_ = ((p_k < v_k1_1) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_a_0; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k == v_k1_1) ? p_t : ((p_k < v_k2_3) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_b_2; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k == v_k2_3) ? p_t : ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_c_4; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }))))); res_; }); }) : ({ __auto_type v_a_0 = s0->u.C_Coll__B4.f_a; __auto_type v_k1_1 = s0->u.C_Coll__B4.f_k1; __auto_type v_b_2 = s0->u.C_Coll__B4.f_b; __auto_type v_k2_3 = s0->u.C_Coll__B4.f_k2; __auto_type v_c_4 = s0->u.C_Coll__B4.f_c; __auto_type v_k3_5 = s0->u.C_Coll__B4.f_k3; __auto_type v_d_6 = s0->u.C_Coll__B4.f_d; ({ __auto_type res_ = ((p_k < v_k1_1) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_a_0; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k == v_k1_1) ? p_t : ((p_k < v_k2_3) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_b_2; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k == v_k2_3) ? p_t : ((p_k < v_k3_5) ? ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_c_4; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }) : ((p_k == v_k3_5) ? p_t : ({ struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* t0 = v_d_6; int64_t t1 = p_k; p_t = t0; p_k = t1; goto srs_tail; (struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee*){0}; }))))))); res_; }); }); }); } static bool f_Coll__bIsNode__Coll__List_1_Coll__SEntry_1_Eff__Callee(struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Eff__Callee* p_n) { return ({ __auto_type s0 = p_n; s0->tag == 0 ? ({ false; }) : s0->tag == 1 ? ({ true; }) : s0->tag == 2 ? ({ true; }) : ({ true; }); }); } @@ -3660,8 +3669,9 @@ static bool f_Eff__isIn(srs_cap* p_r, struct E_Coll__SMap__Bool* p_m, struct E_S static struct E_Coll__Option__Bool* f_Coll__sLookup__Bool(srs_cap* p_r, struct E_Coll__SMap__Bool* p_m, struct E_Sym__Sym* p_s) { return ({ __auto_type s0 = p_m; ({ __auto_type v_t_0 = s0->u.C_Coll__SMap.f_t; f_Coll__sFind__Bool(p_r, f_Coll__bTGetOr__Coll__List_1_Coll__SEntry_1_Bool(v_t_0, f_Sym__hash(p_s), (&N_Coll__Nil__Coll__SEntry_1_Bool)), p_s); }); }); } static struct E_Coll__Option__Bool* f_Coll__sFind__Bool(srs_cap* p_r, struct E_Coll__List__Coll__SEntry_1_Bool* p_xs, struct E_Sym__Sym* p_s) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ (&N_Coll__None__Bool); }) : ({ __auto_type v_e_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_e_0; ({ __auto_type v_s2_2 = s2->u.C_Coll__SEntry.f_s; __auto_type v_v_3 = s2->u.C_Coll__SEntry.f_v; (f_Sym__eq(p_s, v_s2_2) ? ({ struct E_Coll__Option__Bool* o4 = (struct E_Coll__Option__Bool*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__Option__Bool, u) + sizeof(((struct E_Coll__Option__Bool*)0)->u.C_Coll__Some))); o4->tag = 1; o4->u.C_Coll__Some.f_v = v_v_3; o4; }) : ({ srs_cap* t0 = p_r; struct E_Coll__List__Coll__SEntry_1_Bool* t1 = v_t_1; struct E_Sym__Sym* t2 = p_s; p_r = t0; p_xs = t1; p_s = t2; goto srs_tail; (struct E_Coll__Option__Bool*){0}; })); }); }); }); }); } static struct E_Coll__List__Coll__SEntry_1_Bool* f_Coll__bTGetOr__Coll__List_1_Coll__SEntry_1_Bool(struct E_Coll__BTree__Coll__List_1_Coll__SEntry_1_Bool* p_t, int64_t p_k, struct E_Coll__List__Coll__SEntry_1_Bool* p_d) { return f_Coll__bValOr__Coll__List_1_Coll__SEntry_1_Bool(f_Coll__bFind__Coll__List_1_Coll__SEntry_1_Bool(p_t, p_k), p_k, p_d); } -static struct E_Coll__List__D__Fact* f_Eff__decls(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ ({ __auto_type res_ = ({ __auto_type s0 = p_w; ({ __auto_type v_fs_0 = s0->u.C_Eff__W.f_facts; ({ __auto_type res_ = v_fs_0; res_; }); }); }); res_; }); }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = p_w; ({ __auto_type v_n_3 = s3->u.C_Eff__W.f_next; __auto_type v_fs_4 = s3->u.C_Eff__W.f_facts; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Coll__List__Ast__Decl* t2 = v_rest_1; struct E_Eff__W* t3 = f_Eff__fn(p_r, p_cx, v_f_2, ({ struct E_Eff__W* o5 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o5->tag = 0; o5->u.C_Eff__W.f_next = v_n_3; o5->u.C_Eff__W.f_facts = v_fs_4; o5->u.C_Eff__W.f_reqs = (&N_Coll__Nil__Sym__Sym); o5->u.C_Eff__W.f_calls = f_Coll__sEmpty__Coll__List_1_I64(p_r); o5; })); p_r = t0; p_cx = t1; p_ds = t2; p_w = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Coll__List__Ast__Decl* t2 = v_rest_1; struct E_Eff__W* t3 = p_w; p_r = t0; p_cx = t1; p_ds = t2; p_w = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); }); }); }); }); } -static struct E_Eff__W* f_Eff__fn(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Ast__Fn* p_f, struct E_Eff__W* p_w) { return ({ __auto_type res_ = ({ __auto_type s0 = p_f; ({ __auto_type v_n_0 = s0->u.C_Ast__Fn.f_name; __auto_type v_gs_1 = s0->u.C_Ast__Fn.f_groups; __auto_type v_ps_2 = s0->u.C_Ast__Fn.f_params; __auto_type v_body_3 = s0->u.C_Ast__Fn.f_body; ({ struct E_Coll__List__Ast__Binder* v_ev_4 = f_Ty__evidence(p_r, v_gs_1, (&N_Coll__Nil__Ast__Binder)); struct E_Eff__W* v_w1_5 = f_Eff__declsOf(p_r, p_cx, v_n_0, v_ev_4, p_w); __auto_type res_ = ({ __auto_type s6 = v_body_3; s6->tag == 0 ? ({ __auto_type v_e_6 = s6->u.C_Ast__Def.f_e; f_Eff__expr(p_r, p_cx, ({ struct E_Eff__At* o7 = (struct E_Eff__At*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__At, u) + sizeof(((struct E_Eff__At*)0)->u.C_Eff__At))); o7->tag = 0; o7->u.C_Eff__At.f_f = v_n_0; o7->u.C_Eff__At.f_s = ((int64_t)0); o7->u.C_Eff__At.f_hd = (&N_Coll__Nil__Sym__Sym); o7->u.C_Eff__At.f_ls = f_Ty__names(p_r, v_ps_2, f_Ty__names(p_r, v_ev_4, (&N_Coll__Nil__Sym__Sym))); o7; }), v_e_6, v_w1_5); }) : ({ v_w1_5; }); }); res_; }); }); }); res_; }); } +static struct E_Coll__List__D__Fact* f_Eff__decls(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ ({ __auto_type res_ = ({ __auto_type s0 = p_w; ({ __auto_type v_fs_0 = s0->u.C_Eff__W.f_facts; ({ __auto_type res_ = v_fs_0; res_; }); }); }); res_; }); }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = p_w; ({ __auto_type v_n_3 = s3->u.C_Eff__W.f_next; __auto_type v_fs_4 = s3->u.C_Eff__W.f_facts; ({ __auto_type res_ = ({ __auto_type s5 = v_f_2; ({ __auto_type v_fname_5 = s5->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Coll__List__Ast__Decl* t2 = v_rest_1; struct E_Eff__W* t3 = f_Eff__fn(p_r, p_cx, v_fname_5, v_f_2, ({ struct E_Eff__W* o6 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o6->tag = 0; o6->u.C_Eff__W.f_next = v_n_3; o6->u.C_Eff__W.f_facts = v_fs_4; o6->u.C_Eff__W.f_reqs = (&N_Coll__Nil__Sym__Sym); o6->u.C_Eff__W.f_calls = f_Coll__sEmpty__Coll__List_1_I64(p_r); o6; })); p_r = t0; p_cx = t1; p_ds = t2; p_w = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = p_w; ({ __auto_type v_n_3 = s3->u.C_Eff__W.f_next; __auto_type v_fs_4 = s3->u.C_Eff__W.f_facts; ({ __auto_type res_ = ({ __auto_type s5 = v_h_2; ({ __auto_type v_hn_5 = s5->u.C_Ast__Handler.f_name; __auto_type v_hfs_6 = s5->u.C_Ast__Handler.f_fns; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Coll__List__Ast__Decl* t2 = v_rest_1; struct E_Eff__W* t3 = f_Eff__hfns(p_r, p_cx, v_hn_5, v_hfs_6, ({ struct E_Eff__W* o7 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o7->tag = 0; o7->u.C_Eff__W.f_next = v_n_3; o7->u.C_Eff__W.f_facts = v_fs_4; o7->u.C_Eff__W.f_reqs = (&N_Coll__Nil__Sym__Sym); o7->u.C_Eff__W.f_calls = f_Coll__sEmpty__Coll__List_1_I64(p_r); o7; })); p_r = t0; p_cx = t1; p_ds = t2; p_w = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Coll__List__Ast__Decl* t2 = v_rest_1; struct E_Eff__W* t3 = p_w; p_r = t0; p_cx = t1; p_ds = t2; p_w = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); }); }); }); }); } +static struct E_Eff__W* f_Eff__fn(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_n, struct E_Ast__Fn* p_f, struct E_Eff__W* p_w) { return ({ __auto_type res_ = ({ __auto_type s0 = p_f; ({ __auto_type v_gs_0 = s0->u.C_Ast__Fn.f_groups; __auto_type v_ps_1 = s0->u.C_Ast__Fn.f_params; __auto_type v_body_2 = s0->u.C_Ast__Fn.f_body; ({ struct E_Coll__List__Ast__Binder* v_ev_3 = f_Ty__evidence(p_r, v_gs_0, (&N_Coll__Nil__Ast__Binder)); struct E_Eff__W* v_w1_4 = f_Eff__declsOf(p_r, p_cx, p_n, v_ev_3, p_w); __auto_type res_ = ({ __auto_type s5 = v_body_2; s5->tag == 0 ? ({ __auto_type v_e_5 = s5->u.C_Ast__Def.f_e; f_Eff__expr(p_r, p_cx, ({ struct E_Eff__At* o6 = (struct E_Eff__At*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__At, u) + sizeof(((struct E_Eff__At*)0)->u.C_Eff__At))); o6->tag = 0; o6->u.C_Eff__At.f_f = p_n; o6->u.C_Eff__At.f_s = ((int64_t)0); o6->u.C_Eff__At.f_hd = (&N_Coll__Nil__Sym__Sym); o6->u.C_Eff__At.f_ls = f_Ty__names(p_r, v_ps_1, f_Ty__names(p_r, v_ev_3, (&N_Coll__Nil__Sym__Sym))); o6; }), v_e_5, v_w1_4); }) : ({ v_w1_4; }); }); res_; }); }); }); res_; }); } +static struct E_Eff__W* f_Eff__hfns(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_h, struct E_Coll__List__Ast__Fn* p_fs, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ p_w; }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Sym__Sym* t2 = p_h; struct E_Coll__List__Ast__Fn* t3 = v_rest_1; struct E_Eff__W* t4 = f_Eff__fn(p_r, p_cx, p_h, v_f_0, p_w); p_r = t0; p_cx = t1; p_h = t2; p_fs = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }); }); } static struct E_Eff__W* f_Eff__declsOf(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Sym__Sym* p_f, struct E_Coll__List__Ast__Binder* p_bs, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_bs; s0->tag == 0 ? ({ p_w; }) : ({ __auto_type v_b_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_b_0; ({ __auto_type v_t_2 = s2->u.C_Ast__Binder.f_ty; ({ __auto_type res_ = ({ __auto_type s3 = v_t_2; ({ __auto_type v_tn_3 = s3->u.C_Ast__Ty.f_name; ({ __auto_type res_ = ({ __auto_type s4 = p_cx; ({ __auto_type v_ps_4 = s4->u.C_Eff__Cx.f_ps; __auto_type v_ss_5 = s4->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s6 = v_ss_5; ({ __auto_type v_decl_6 = s6->u.C_Eff__Syms.f_decl; ({ __auto_type res_ = (f_Ty__isProto(v_ps_4, v_tn_3) ? ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Sym__Sym* t2 = p_f; struct E_Coll__List__Ast__Binder* t3 = v_rest_1; struct E_Eff__W* t4 = f_Eff__add(p_r, p_w, v_decl_6, f_Eff__v2(p_r, ({ struct E_D__Val* o7 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o7->tag = 0; o7->u.C_D__VSym.f_s = p_f; o7; }), ({ struct E_D__Val* o7 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o7->tag = 0; o7->u.C_D__VSym.f_s = v_tn_3; o7; }))); p_r = t0; p_cx = t1; p_f = t2; p_bs = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }) : ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Sym__Sym* t2 = p_f; struct E_Coll__List__Ast__Binder* t3 = v_rest_1; struct E_Eff__W* t4 = p_w; p_r = t0; p_cx = t1; p_f = t2; p_bs = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; })); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } static struct E_Eff__W* f_Eff__req(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Sym__Sym* p_p, struct E_Eff__W* p_w) { return ({ __auto_type res_ = ({ __auto_type s0 = p_at; ({ __auto_type v_f_0 = s0->u.C_Eff__At.f_f; __auto_type v_hd_1 = s0->u.C_Eff__At.f_hd; ({ __auto_type res_ = ({ __auto_type s2 = p_w; ({ __auto_type v_n_2 = s2->u.C_Eff__W.f_next; __auto_type v_fs_3 = s2->u.C_Eff__W.f_facts; __auto_type v_rq_4 = s2->u.C_Eff__W.f_reqs; __auto_type v_cs_5 = s2->u.C_Eff__W.f_calls; ({ __auto_type res_ = ((f_Ty__memberSym(p_p, v_hd_1) || f_Ty__memberSym(p_p, v_rq_4)) ? p_w : ({ __auto_type res_ = ({ __auto_type s6 = p_cx; ({ __auto_type v_ss_6 = s6->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s7 = v_ss_6; ({ __auto_type v_req_7 = s7->u.C_Eff__Syms.f_req; ({ __auto_type res_ = ({ struct E_Eff__W* o8 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o8->tag = 0; o8->u.C_Eff__W.f_next = v_n_2; o8->u.C_Eff__W.f_facts = ({ struct E_Coll__List__D__Fact* o8 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = ({ struct E_D__Fact* o8 = (struct E_D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Fact, u) + sizeof(((struct E_D__Fact*)0)->u.C_D__Fact))); o8->tag = 0; o8->u.C_D__Fact.f_rel = v_req_7; o8->u.C_D__Fact.f_vals = f_Eff__v2(p_r, ({ struct E_D__Val* o8 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o8->tag = 0; o8->u.C_D__VSym.f_s = v_f_0; o8; }), ({ struct E_D__Val* o8 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o8->tag = 0; o8->u.C_D__VSym.f_s = p_p; o8; })); o8; }); o8->u.C_Coll__Cons.f_t = v_fs_3; o8; }); o8->u.C_Eff__W.f_reqs = ({ struct E_Coll__List__Sym__Sym* o8 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = p_p; o8->u.C_Coll__Cons.f_t = v_rq_4; o8; }); o8->u.C_Eff__W.f_calls = v_cs_5; o8; }); res_; }); }); }); res_; }); }); }); res_; })); res_; }); }); }); res_; }); }); }); res_; }); } static struct E_Eff__W* f_Eff__call(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Sym__Sym* p_g, struct E_Eff__W* p_w) { return ({ __auto_type res_ = ({ __auto_type s0 = p_at; ({ __auto_type v_f_0 = s0->u.C_Eff__At.f_f; __auto_type v_s_1 = s0->u.C_Eff__At.f_s; ({ __auto_type res_ = ({ __auto_type s2 = p_cx; ({ __auto_type v_fns_2 = s2->u.C_Eff__Cx.f_fns; __auto_type v_ss_3 = s2->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s4 = p_w; ({ __auto_type v_n_4 = s4->u.C_Eff__W.f_next; __auto_type v_fs_5 = s4->u.C_Eff__W.f_facts; __auto_type v_rq_6 = s4->u.C_Eff__W.f_reqs; __auto_type v_cs_7 = s4->u.C_Eff__W.f_calls; ({ struct E_Coll__List__I64* v_seen_8 = ({ __auto_type s8 = f_Coll__sLookup__Coll__List_1_I64(p_r, v_cs_7, p_g); s8->tag == 1 ? ({ __auto_type v_xs_8 = s8->u.C_Coll__Some.f_v; v_xs_8; }) : ({ (&N_Coll__Nil__I64); }); }); bool v_leaf_9 = ({ __auto_type s9 = f_Coll__sLookup__Eff__Callee(p_r, v_fns_2, p_g); s9->tag == 1 ? ({ __auto_type v_k_9 = s9->u.C_Coll__Some.f_v; ({ __auto_type s10 = v_k_9; s10->tag == 1 ? ({ true; }) : ({ false; }); }); }) : ({ true; }); }); __auto_type res_ = (((v_leaf_9 || f_Sym__eq(v_f_0, p_g)) || f_Eff__memberI(v_s_1, v_seen_8)) ? p_w : ({ __auto_type res_ = ({ __auto_type s10 = v_ss_3; ({ __auto_type v_calls_10 = s10->u.C_Eff__Syms.f_calls; ({ __auto_type res_ = ({ struct E_Eff__W* o11 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o11->tag = 0; o11->u.C_Eff__W.f_next = v_n_4; o11->u.C_Eff__W.f_facts = ({ struct E_Coll__List__D__Fact* o11 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o11->tag = 1; o11->u.C_Coll__Cons.f_h = ({ struct E_D__Fact* o11 = (struct E_D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Fact, u) + sizeof(((struct E_D__Fact*)0)->u.C_D__Fact))); o11->tag = 0; o11->u.C_D__Fact.f_rel = v_calls_10; o11->u.C_D__Fact.f_vals = ({ struct E_Coll__List__D__Val* o11 = (struct E_Coll__List__D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Val, u) + sizeof(((struct E_Coll__List__D__Val*)0)->u.C_Coll__Cons))); o11->tag = 1; o11->u.C_Coll__Cons.f_h = ({ struct E_D__Val* o11 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o11->tag = 0; o11->u.C_D__VSym.f_s = v_f_0; o11; }); o11->u.C_Coll__Cons.f_t = f_Eff__v2(p_r, ({ struct E_D__Val* o11 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o11->tag = 0; o11->u.C_D__VSym.f_s = p_g; o11; }), ({ struct E_D__Val* o11 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VInt))); o11->tag = 1; o11->u.C_D__VInt.f_v = v_s_1; o11; })); o11; }); o11; }); o11->u.C_Coll__Cons.f_t = v_fs_5; o11; }); o11->u.C_Eff__W.f_reqs = v_rq_6; o11->u.C_Eff__W.f_calls = f_Coll__sInsert__Coll__List_1_I64(p_r, v_cs_7, p_g, ({ struct E_Coll__List__I64* o11 = (struct E_Coll__List__I64*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__I64, u) + sizeof(((struct E_Coll__List__I64*)0)->u.C_Coll__Cons))); o11->tag = 1; o11->u.C_Coll__Cons.f_h = v_s_1; o11->u.C_Coll__Cons.f_t = v_seen_8; o11; })); o11; }); res_; }); }); }); res_; })); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); } @@ -3698,7 +3708,7 @@ static struct E_Coll__List__Sym__Sym* f_Coll__revOnto__Sym__Sym(srs_cap* p_r, st static struct E_Eff__W* f_Eff__expr(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Ast__Expr* p_e, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_e; s0->tag == 4 ? ({ __auto_type v_x_0 = s0->u.C_Ast__Name.f_n; ({ __auto_type res_ = ({ __auto_type s1 = p_at; ({ __auto_type v_ls_1 = s1->u.C_Eff__At.f_ls; ({ __auto_type res_ = (f_Ty__memberSym(v_x_0, v_ls_1) ? p_w : f_Eff__call(p_r, p_cx, p_at, v_x_0, p_w)); res_; }); }); }); res_; }); }) : s0->tag == 5 ? ({ __auto_type v_g_0 = s0->u.C_Ast__Call.f_f; __auto_type v_xs_1 = s0->u.C_Ast__Call.f_args; ({ struct E_Eff__W* v_w1_2 = f_Eff__exprs(p_r, p_cx, p_at, v_xs_1, p_w); __auto_type res_ = ({ __auto_type s3 = p_cx; ({ __auto_type v_ps_3 = s3->u.C_Eff__Cx.f_ps; __auto_type v_fns_4 = s3->u.C_Eff__Cx.f_fns; __auto_type v_ctors_5 = s3->u.C_Eff__Cx.f_ctors; __auto_type v_ss_6 = s3->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s7 = v_ss_6; ({ __auto_type v_region_7 = s7->u.C_Eff__Syms.f_region; ({ __auto_type res_ = (f_Eff__isFn(p_r, v_fns_4, v_g_0) ? f_Eff__call(p_r, p_cx, p_at, v_g_0, v_w1_2) : (f_Eff__isIn(p_r, v_ctors_5, v_g_0) ? f_Eff__req(p_r, p_cx, p_at, v_region_7, v_w1_2) : f_Eff__reqTo(p_r, p_cx, p_at, f_Eff__reqOf(p_r, v_ps_3, v_g_0), v_w1_2))); res_; }); }); }); res_; }); }); }); res_; }); }) : s0->tag == 6 ? ({ __auto_type v_xs_0 = s0->u.C_Ast__Method.f_args; f_Eff__exprs(p_r, p_cx, p_at, v_xs_0, p_w); }) : s0->tag == 7 ? ({ __auto_type v_l_0 = s0->u.C_Ast__Bin.f_l; __auto_type v_x_1 = s0->u.C_Ast__Bin.f_rhs; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Ast__Expr* t3 = v_x_1; struct E_Eff__W* t4 = f_Eff__expr(p_r, p_cx, p_at, v_l_0, p_w); p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s0->tag == 8 ? ({ __auto_type v_x_0 = s0->u.C_Ast__Un.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Ast__Expr* t3 = v_x_0; struct E_Eff__W* t4 = p_w; p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s0->tag == 9 ? ({ __auto_type v_c_0 = s0->u.C_Ast__If.f_c; __auto_type v_t_1 = s0->u.C_Ast__If.f_t; __auto_type v_x_2 = s0->u.C_Ast__If.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Ast__Expr* t3 = v_x_2; struct E_Eff__W* t4 = f_Eff__expr(p_r, p_cx, p_at, v_t_1, f_Eff__expr(p_r, p_cx, p_at, v_c_0, p_w)); p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s0->tag == 10 ? ({ __auto_type v_s_0 = s0->u.C_Ast__Match.f_s; __auto_type v_arms_1 = s0->u.C_Ast__Match.f_arms; f_Eff__arms(p_r, p_cx, p_at, v_arms_1, f_Eff__expr(p_r, p_cx, p_at, v_s_0, p_w)); }) : s0->tag == 11 ? ({ __auto_type v_ss_0 = s0->u.C_Ast__Block.f_stmts; __auto_type v_last_1 = s0->u.C_Ast__Block.f_last; f_Eff__stmts(p_r, p_cx, p_at, v_ss_0, v_last_1, p_w); }) : s0->tag == 12 ? ({ __auto_type v_c_0 = s0->u.C_Ast__While.f_c; __auto_type v_b_1 = s0->u.C_Ast__While.f_body; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Ast__Expr* t3 = v_b_1; struct E_Eff__W* t4 = f_Eff__expr(p_r, p_cx, p_at, v_c_0, p_w); p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s0->tag == 13 ? ({ __auto_type v_x_0 = s0->u.C_Ast__Assign.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Ast__Expr* t3 = v_x_0; struct E_Eff__W* t4 = p_w; p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s0->tag == 14 ? ({ __auto_type v_x_0 = s0->u.C_Ast__Quant.f_x; __auto_type v_b_1 = s0->u.C_Ast__Quant.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = f_Eff__local(p_r, p_at, ({ struct E_Coll__List__Sym__Sym* o2 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_x_0; o2->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o2; })); struct E_Ast__Expr* t3 = v_b_1; struct E_Eff__W* t4 = p_w; p_r = t0; p_cx = t1; p_at = t2; p_e = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }) : ({ p_w; }); }); } static struct E_Eff__W* f_Eff__exprs(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Coll__List__Ast__Expr* p_xs, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_w; }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Expr* t3 = v_rest_1; struct E_Eff__W* t4 = f_Eff__expr(p_r, p_cx, p_at, v_x_0, p_w); p_r = t0; p_cx = t1; p_at = t2; p_xs = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }); }); } static struct E_Eff__W* f_Eff__arms(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Coll__List__Ast__Arm* p_as, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_as; s0->tag == 0 ? ({ p_w; }) : ({ __auto_type v_a_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_a_0; ({ __auto_type v_p_2 = s2->u.C_Ast__Arm.f_p; __auto_type v_b_3 = s2->u.C_Ast__Arm.f_body; ({ struct E_Eff__At* v_at2_4 = ({ __auto_type s4 = v_p_2; s4->tag == 0 ? ({ __auto_type v_xs_4 = s4->u.C_Ast__PCase.f_binds; f_Eff__local(p_r, p_at, v_xs_4); }) : ({ p_at; }); }); __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Arm* t3 = v_rest_1; struct E_Eff__W* t4 = f_Eff__expr(p_r, p_cx, v_at2_4, v_b_3, p_w); p_r = t0; p_cx = t1; p_at = t2; p_as = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); res_; }); }); }); res_; }); }); }); } -static struct E_Eff__W* f_Eff__stmts(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Coll__List__Ast__Stmt* p_ss, struct E_Ast__Expr* p_last, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ f_Eff__expr(p_r, p_cx, p_at, p_last, p_w); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Val.f_x; __auto_type v_e_3 = s2->u.C_Ast__Val.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = f_Eff__local(p_r, p_at, ({ struct E_Coll__List__Sym__Sym* o4 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_x_2; o4->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o4; })); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_3, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s2->tag == 1 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Var.f_x; __auto_type v_e_3 = s2->u.C_Ast__Var.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = f_Eff__local(p_r, p_at, ({ struct E_Coll__List__Sym__Sym* o4 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_x_2; o4->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o4; })); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_3, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s2->tag == 2 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Handle.f_x; __auto_type v_h_3 = s2->u.C_Ast__Handle.f_h; __auto_type v_xs_4 = s2->u.C_Ast__Handle.f_args; ({ __auto_type res_ = ({ __auto_type s5 = f_Eff__exprs(p_r, p_cx, p_at, v_xs_4, p_w); ({ __auto_type v_n_5 = s5->u.C_Eff__W.f_next; __auto_type v_fs_6 = s5->u.C_Eff__W.f_facts; __auto_type v_rq_7 = s5->u.C_Eff__W.f_reqs; __auto_type v_cs_8 = s5->u.C_Eff__W.f_calls; ({ __auto_type res_ = ({ __auto_type s9 = p_cx; ({ __auto_type v_hp_9 = s9->u.C_Eff__Cx.f_hp; __auto_type v_ss_10 = s9->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s11 = v_ss_10; ({ __auto_type v_hdRel_11 = s11->u.C_Eff__Syms.f_hd; ({ __auto_type res_ = ({ __auto_type s12 = p_at; ({ __auto_type v_f_12 = s12->u.C_Eff__At.f_f; __auto_type v_hd_13 = s12->u.C_Eff__At.f_hd; __auto_type v_ls_14 = s12->u.C_Eff__At.f_ls; ({ struct E_Coll__List__Sym__Sym* v_hd2_15 = ({ __auto_type s15 = f_Coll__sLookup__Sym__Sym(p_r, v_hp_9, v_h_3); s15->tag == 1 ? ({ __auto_type v_p_15 = s15->u.C_Coll__Some.f_v; ({ struct E_Coll__List__Sym__Sym* o16 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o16->tag = 1; o16->u.C_Coll__Cons.f_h = v_p_15; o16->u.C_Coll__Cons.f_t = v_hd_13; o16; }); }) : ({ v_hd_13; }); }); __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = ({ struct E_Eff__At* o16 = (struct E_Eff__At*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__At, u) + sizeof(((struct E_Eff__At*)0)->u.C_Eff__At))); o16->tag = 0; o16->u.C_Eff__At.f_f = v_f_12; o16->u.C_Eff__At.f_s = v_n_5; o16->u.C_Eff__At.f_hd = v_hd2_15; o16->u.C_Eff__At.f_ls = ({ struct E_Coll__List__Sym__Sym* o16 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o16->tag = 1; o16->u.C_Coll__Cons.f_h = v_x_2; o16->u.C_Coll__Cons.f_t = v_ls_14; o16; }); o16; }); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__hds(p_r, v_hdRel_11, v_n_5, v_hd2_15, ({ struct E_Eff__W* o16 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o16->tag = 0; o16->u.C_Eff__W.f_next = (v_n_5 + ((int64_t)1)); o16->u.C_Eff__W.f_facts = v_fs_6; o16->u.C_Eff__W.f_reqs = v_rq_7; o16->u.C_Eff__W.f_calls = v_cs_8; o16; })); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_e_2 = s2->u.C_Ast__Do.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_2, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : ({ __auto_type v_e_2 = s2->u.C_Ast__Check.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_2, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }); }); }); }); } +static struct E_Eff__W* f_Eff__stmts(srs_cap* p_r, struct E_Eff__Cx* p_cx, struct E_Eff__At* p_at, struct E_Coll__List__Ast__Stmt* p_ss, struct E_Ast__Expr* p_last, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ f_Eff__expr(p_r, p_cx, p_at, p_last, p_w); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Val.f_x; __auto_type v_e_3 = s2->u.C_Ast__Val.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = f_Eff__local(p_r, p_at, ({ struct E_Coll__List__Sym__Sym* o4 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_x_2; o4->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o4; })); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_3, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s2->tag == 1 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Var.f_x; __auto_type v_e_3 = s2->u.C_Ast__Var.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = f_Eff__local(p_r, p_at, ({ struct E_Coll__List__Sym__Sym* o4 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_x_2; o4->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o4; })); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_3, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : s2->tag == 2 ? ({ __auto_type v_x_2 = s2->u.C_Ast__Handle.f_x; __auto_type v_h_3 = s2->u.C_Ast__Handle.f_h; __auto_type v_xs_4 = s2->u.C_Ast__Handle.f_args; ({ __auto_type res_ = ({ __auto_type s5 = f_Eff__call(p_r, p_cx, p_at, v_h_3, f_Eff__exprs(p_r, p_cx, p_at, v_xs_4, p_w)); ({ __auto_type v_n_5 = s5->u.C_Eff__W.f_next; __auto_type v_fs_6 = s5->u.C_Eff__W.f_facts; __auto_type v_rq_7 = s5->u.C_Eff__W.f_reqs; __auto_type v_cs_8 = s5->u.C_Eff__W.f_calls; ({ __auto_type res_ = ({ __auto_type s9 = p_cx; ({ __auto_type v_hp_9 = s9->u.C_Eff__Cx.f_hp; __auto_type v_ss_10 = s9->u.C_Eff__Cx.f_ss; ({ __auto_type res_ = ({ __auto_type s11 = v_ss_10; ({ __auto_type v_hdRel_11 = s11->u.C_Eff__Syms.f_hd; ({ __auto_type res_ = ({ __auto_type s12 = p_at; ({ __auto_type v_f_12 = s12->u.C_Eff__At.f_f; __auto_type v_hd_13 = s12->u.C_Eff__At.f_hd; __auto_type v_ls_14 = s12->u.C_Eff__At.f_ls; ({ struct E_Coll__List__Sym__Sym* v_hd2_15 = ({ __auto_type s15 = f_Coll__sLookup__Sym__Sym(p_r, v_hp_9, v_h_3); s15->tag == 1 ? ({ __auto_type v_p_15 = s15->u.C_Coll__Some.f_v; ({ struct E_Coll__List__Sym__Sym* o16 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o16->tag = 1; o16->u.C_Coll__Cons.f_h = v_p_15; o16->u.C_Coll__Cons.f_t = v_hd_13; o16; }); }) : ({ v_hd_13; }); }); __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = ({ struct E_Eff__At* o16 = (struct E_Eff__At*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__At, u) + sizeof(((struct E_Eff__At*)0)->u.C_Eff__At))); o16->tag = 0; o16->u.C_Eff__At.f_f = v_f_12; o16->u.C_Eff__At.f_s = v_n_5; o16->u.C_Eff__At.f_hd = v_hd2_15; o16->u.C_Eff__At.f_ls = ({ struct E_Coll__List__Sym__Sym* o16 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o16->tag = 1; o16->u.C_Coll__Cons.f_h = v_x_2; o16->u.C_Coll__Cons.f_t = v_ls_14; o16; }); o16; }); struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__hds(p_r, v_hdRel_11, v_n_5, v_hd2_15, ({ struct E_Eff__W* o16 = (struct E_Eff__W*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Eff__W, u) + sizeof(((struct E_Eff__W*)0)->u.C_Eff__W))); o16->tag = 0; o16->u.C_Eff__W.f_next = (v_n_5 + ((int64_t)1)); o16->u.C_Eff__W.f_facts = v_fs_6; o16->u.C_Eff__W.f_reqs = v_rq_7; o16->u.C_Eff__W.f_calls = v_cs_8; o16; })); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_e_2 = s2->u.C_Ast__Do.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_2, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }) : ({ __auto_type v_e_2 = s2->u.C_Ast__Check.f_e; ({ srs_cap* t0 = p_r; struct E_Eff__Cx* t1 = p_cx; struct E_Eff__At* t2 = p_at; struct E_Coll__List__Ast__Stmt* t3 = v_rest_1; struct E_Ast__Expr* t4 = p_last; struct E_Eff__W* t5 = f_Eff__expr(p_r, p_cx, p_at, v_e_2, p_w); p_r = t0; p_cx = t1; p_at = t2; p_ss = t3; p_last = t4; p_w = t5; goto srs_tail; (struct E_Eff__W*){0}; }); }); }); }); }); } static struct E_Eff__W* f_Eff__hds(srs_cap* p_r, struct E_Sym__Sym* p_rel, int64_t p_s, struct E_Coll__List__Sym__Sym* p_ps, struct E_Eff__W* p_w) { srs_tail: return ({ __auto_type s0 = p_ps; s0->tag == 0 ? ({ p_w; }) : ({ __auto_type v_p_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Sym__Sym* t1 = p_rel; int64_t t2 = p_s; struct E_Coll__List__Sym__Sym* t3 = v_rest_1; struct E_Eff__W* t4 = f_Eff__add(p_r, p_w, p_rel, f_Eff__v2(p_r, ({ struct E_D__Val* o2 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VInt))); o2->tag = 1; o2->u.C_D__VInt.f_v = p_s; o2; }), ({ struct E_D__Val* o2 = (struct E_D__Val*)srs_alloc(p_r, (int64_t)(offsetof(struct E_D__Val, u) + sizeof(((struct E_D__Val*)0)->u.C_D__VSym))); o2->tag = 0; o2->u.C_D__VSym.f_s = v_p_0; o2; }))); p_r = t0; p_rel = t1; p_s = t2; p_ps = t3; p_w = t4; goto srs_tail; (struct E_Eff__W*){0}; }); }); }); } static struct E_Emit__Cx* f_Emit__cxOf(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__IMap__K__Term* p_s, struct E_Coll__List__El__Fn* p_fs) { return ({ __auto_type res_ = f_Emit__cxDecls(p_r, p_ds, ({ struct E_Emit__Cx* o0 = (struct E_Emit__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Cx, u) + sizeof(((struct E_Emit__Cx*)0)->u.C_Emit__Cx))); o0->tag = 0; o0->u.C_Emit__Cx.f_s = p_s; o0->u.C_Emit__Cx.f_fns = f_Emit__fnMap(p_r, p_fs, f_Coll__sEmpty__El__Fn(p_r)); o0->u.C_Emit__Cx.f_cases = f_Coll__sEmpty__Emit__CaseAt(p_r); o0->u.C_Emit__Cx.f_enums = f_Coll__sEmpty__Ast__Enum(p_r); o0->u.C_Emit__Cx.f_protos = f_Coll__sEmpty__Ast__Proto(p_r); o0->u.C_Emit__Cx.f_hprotos = f_Coll__sEmpty__Sym__Sym(p_r); o0->u.C_Emit__Cx.f_alloc = (&N_Emit__VTable); o0->u.C_Emit__Cx.f_nominal = f_Coll__sEmpty__K__Term(p_r); o0; })); res_; }); } static struct E_Coll__SMap__El__Fn* f_Coll__sEmpty__El__Fn(srs_cap* p_r) { return ({ struct E_Coll__SMap__El__Fn* o0 = (struct E_Coll__SMap__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__SMap__El__Fn, u) + sizeof(((struct E_Coll__SMap__El__Fn*)0)->u.C_Coll__SMap))); o0->tag = 0; o0->u.C_Coll__SMap.f_t = (&N_Coll__BTip__Coll__List_1_Coll__SEntry_1_El__Fn); o0; }); } @@ -3849,6 +3859,8 @@ static struct E_Coll__List__Coll__SEntry_1_El__Fn* f_Coll__bTGetOr__Coll__List_1 static int64_t f_Emit__defName(srs_cap* p_eff__Console, struct E_Sym__Sym* p_f, struct E_Coll__List__K__Term* p_ts) { return ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"f_", 2})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_f)); __auto_type res_ = f_Emit__suffix(p_eff__Console, p_ts); res_; }); } static int64_t f_Emit__sep(srs_cap* p_eff__Console, struct E_Emit__Sep* p_s) { return ({ __auto_type s0 = p_s; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", ", 2})); p_eff__Console->live = 0; r_; }); }); }); } static int64_t f_Emit__capArgs(srs_cap* p_eff__Console, struct E_Emit__Env* p_env, struct E_Coll__List__Sym__Sym* p_caps, struct E_Emit__Sep* p_s) { srs_tail: return ({ __auto_type s0 = p_caps; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_c_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ (void)(f_Emit__sep(p_eff__Console, p_s)); (void)(f_Emit__local(p_eff__Console, f_Emit__vs(p_env), v_c_0)); __auto_type res_ = ({ srs_cap* t0 = p_eff__Console; struct E_Emit__Env* t1 = p_env; struct E_Coll__List__Sym__Sym* t2 = v_rest_1; struct E_Emit__Sep* t3 = (&N_Emit__Comma); p_eff__Console = t0; p_env = t1; p_caps = t2; p_s = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); } +static int64_t f_Emit__initCall(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Sym__Sym* p_h, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args) { return ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"h_", 2})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_h)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_init(", 6})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__capArgs(p_eff__Console, p_env, p_caps, (&N_Emit__First))); (void)(f_Emit__args(p_r, p_eff__Console, p_cx, p_fi, p_env, p_args, ((f_Coll__length__Sym__Sym(p_caps) == ((int64_t)0)) ? (&N_Emit__First) : (&N_Emit__Comma)))); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)")", 1})); p_eff__Console->live = 0; r_; }); res_; }); } +static int64_t f_Emit__handleEnv(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Emit__Name* p_v, struct E_Sym__Sym* p_h, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args) { return ({ __auto_type s0 = p_caps; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"struct { void* st; srs_cap* c[", 30})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, f_Coll__length__Sym__Sym(p_caps)); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"]; } ", 5})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, p_v)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_e = { ", 7})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__initCall(p_r, p_eff__Console, p_cx, p_fi, p_env, p_h, p_caps, p_args)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", { ", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__capArgs(p_eff__Console, p_env, p_caps, (&N_Emit__First))); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" } }; ", 6})); p_eff__Console->live = 0; r_; }); res_; }); }); }); } static int64_t f_Emit__args(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__El__Expr* p_xs, struct E_Emit__Sep* p_s) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ (void)(f_Emit__sep(p_eff__Console, p_s)); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_x_0)); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Coll__List__El__Expr* t5 = v_rest_1; struct E_Emit__Sep* t6 = (&N_Emit__Comma); p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_xs = t5; p_s = t6; goto srs_tail; (int64_t){0}; }); res_; }); }); }); } static int64_t f_Emit__jump(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args) { return ({ __auto_type res_ = ({ __auto_type s0 = p_fi; ({ __auto_type v_slots_0 = s0->u.C_Emit__Fi.f_slots; __auto_type v_ret_1 = s0->u.C_Emit__Fi.f_ret; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"({ ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__temps(p_r, p_eff__Console, p_cx, p_fi, p_env, v_slots_0, p_caps, p_args, ((int64_t)0))); (void)(f_Emit__sets(p_eff__Console, v_slots_0, ((int64_t)0))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"goto srs_tail; (", 16})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ctype(p_r, p_eff__Console, p_cx, v_ret_1)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"){0}; })", 8})); p_eff__Console->live = 0; r_; }); res_; }); }); }); res_; }); } static int64_t f_Emit__temps(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Coll__List__Emit__Slot* p_slots, struct E_Coll__List__Sym__Sym* p_caps, struct E_Coll__List__El__Expr* p_args, int64_t p_i) { srs_tail: return ({ __auto_type s0 = p_slots; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_sl_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_sl_0; s2->tag == 0 ? ({ ({ __auto_type s2 = p_caps; s2->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_c_2 = s2->u.C_Coll__Cons.f_h; __auto_type v_crest_3 = s2->u.C_Coll__Cons.f_t; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"srs_cap* t", 10})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, p_i); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__local(p_eff__Console, f_Emit__vs(p_env), v_c_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Coll__List__Emit__Slot* t5 = v_rest_1; struct E_Coll__List__Sym__Sym* t6 = v_crest_3; struct E_Coll__List__El__Expr* t7 = p_args; int64_t t8 = (p_i + ((int64_t)1)); p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_slots = t5; p_caps = t6; p_args = t7; p_i = t8; goto srs_tail; (int64_t){0}; }); res_; }); }); }); }) : ({ __auto_type v_t_2 = s2->u.C_Emit__SVal.f_t; ({ __auto_type s3 = p_args; s3->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_a_3 = s3->u.C_Coll__Cons.f_h; __auto_type v_arest_4 = s3->u.C_Coll__Cons.f_t; ({ (void)(f_Emit__ctype(p_r, p_eff__Console, p_cx, v_t_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" t", 2})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, p_i); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_a_3)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Coll__List__Emit__Slot* t5 = v_rest_1; struct E_Coll__List__Sym__Sym* t6 = p_caps; struct E_Coll__List__El__Expr* t7 = v_arest_4; int64_t t8 = (p_i + ((int64_t)1)); p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_slots = t5; p_caps = t6; p_args = t7; p_i = t8; goto srs_tail; (int64_t){0}; }); res_; }); }); }); }); }); }); }); } @@ -3865,7 +3877,7 @@ static bool f_Emit__allEnd(struct E_Coll__List__Ast__Trans* p_ts, struct E_Coll_ static int64_t f_Emit__arms(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Emit__Pos* p_pos, struct E_Coll__List__El__Arm* p_as) { srs_tail: return ({ __auto_type s0 = p_as; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_a_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_a_0; ({ __auto_type v_p_2 = s2->u.C_El__Arm.f_p; __auto_type v_b_3 = s2->u.C_El__Arm.f_body; ({ int64_t v_n_4 = f_Emit__envN(p_env); (void)(({ __auto_type s5 = v_p_2; s5->tag == 1 ? ({ ({ (void)(f_Emit__test(p_eff__Console, v_rest_1, v_n_4, (&N_Emit__Always))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"({ ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, p_pos, v_b_3)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; })", 4})); p_eff__Console->live = 0; r_; }); res_; }); }) : ({ __auto_type v_c_5 = s5->u.C_Ast__PCase.f_c; __auto_type v_binds_6 = s5->u.C_Ast__PCase.f_binds; ({ __auto_type s7 = f_Emit__caseAt(p_r, p_cx, v_c_5); s7->tag == 0 ? ({ ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"0", 1})); p_eff__Console->live = 0; r_; }); }) : ({ __auto_type v_ca_7 = s7->u.C_Coll__Some.f_v; ({ __auto_type res_ = ({ __auto_type s8 = v_ca_7; ({ __auto_type v_tag_8 = s8->u.C_Emit__CaseAt.f_tag; __auto_type v_cs_9 = s8->u.C_Emit__CaseAt.f_c; ({ __auto_type res_ = ({ __auto_type s10 = v_cs_9; ({ __auto_type v_fields_10 = s10->u.C_Ast__Case.f_fields; ({ (void)(f_Emit__test(p_eff__Console, v_rest_1, v_n_4, ({ struct E_Emit__Guard* o11 = (struct E_Emit__Guard*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Guard, u) + sizeof(((struct E_Emit__Guard*)0)->u.C_Emit__Tag))); o11->tag = 1; o11->u.C_Emit__Tag.f_tag = v_tag_8; o11; }))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"({ ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, f_Emit__binds(p_r, p_eff__Console, p_env, v_n_4, v_c_5, v_binds_6, v_fields_10), p_pos, v_b_3)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; })", 4})); p_eff__Console->live = 0; r_; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); }); })); __auto_type res_ = ({ __auto_type s5 = v_rest_1; s5->tag == 0 ? ({ ((int64_t)0); }) : ({ ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" : ", 3})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Arm* t6 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_as = t6; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } static int64_t f_Emit__test(srs_cap* p_eff__Console, struct E_Coll__List__El__Arm* p_rest, int64_t p_n, struct E_Emit__Guard* p_g) { return ({ __auto_type s0 = p_rest; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ ({ __auto_type s0 = p_g; s0->tag == 0 ? ({ ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"1 ? ", 4})); p_eff__Console->live = 0; r_; }); }) : ({ __auto_type v_tag_0 = s0->u.C_Emit__Tag.f_tag; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"s", 1})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, p_n); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"->tag == ", 9})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, v_tag_0); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" ? ", 3})); p_eff__Console->live = 0; r_; }); res_; }); }); }); }); }); } static struct E_Emit__Env* f_Emit__binds(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Env* p_env, int64_t p_n, struct E_Sym__Sym* p_c, struct E_Coll__List__Sym__Sym* p_xs, struct E_Coll__List__Ast__Binder* p_fs) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_env; }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = p_fs; s2->tag == 0 ? ({ p_env; }) : ({ __auto_type v_f_2 = s2->u.C_Coll__Cons.f_h; __auto_type v_frest_3 = s2->u.C_Coll__Cons.f_t; ({ __auto_type res_ = (Str__eq(f_Sym__str(v_x_0), ((srs_str){(const uint8_t*)"_", 1})) ? ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Env* t2 = p_env; int64_t t3 = p_n; struct E_Sym__Sym* t4 = p_c; struct E_Coll__List__Sym__Sym* t5 = v_rest_1; struct E_Coll__List__Ast__Binder* t6 = v_frest_3; p_r = t0; p_eff__Console = t1; p_env = t2; p_n = t3; p_c = t4; p_xs = t5; p_fs = t6; goto srs_tail; (struct E_Emit__Env*){0}; }) : ({ __auto_type res_ = ({ __auto_type s4 = v_f_2; ({ __auto_type v_fx_4 = s4->u.C_Ast__Binder.f_x; ({ struct E_Emit__Env* v_env2_5 = f_Emit__bind(p_r, p_env, v_x_0); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"__auto_type ", 12})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, ({ struct E_Emit__Name* o6 = (struct E_Emit__Name*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Name, u) + sizeof(((struct E_Emit__Name*)0)->u.C_Emit__L))); o6->tag = 1; o6->u.C_Emit__L.f_x = v_x_0; o6->u.C_Emit__L.f_n = f_Emit__envN(p_env); o6; }))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = s", 4})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, p_n); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"->u.C_", 6})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_c)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)".f_", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_fx_4)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Env* t2 = v_env2_5; int64_t t3 = p_n; struct E_Sym__Sym* t4 = p_c; struct E_Coll__List__Sym__Sym* t5 = v_rest_1; struct E_Coll__List__Ast__Binder* t6 = v_frest_3; p_r = t0; p_eff__Console = t1; p_env = t2; p_n = t3; p_c = t4; p_xs = t5; p_fs = t6; goto srs_tail; (struct E_Emit__Env*){0}; }); res_; }); }); }); res_; })); res_; }); }); }); }); }); } -static int64_t f_Emit__block(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Emit__Pos* p_pos, struct E_Coll__List__El__Stmt* p_ss, struct E_El__Expr* p_last, struct E_Coll__List__Emit__Drop* p_drops) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"__auto_type res_ = ", 19})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, f_Emit__lastPos(p_drops, p_pos), p_last)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__drops(p_r, p_eff__Console, p_cx, p_drops)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"res_; })", 8})); p_eff__Console->live = 0; r_; }); res_; }); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_x_2 = s2->u.C_El__Val.f_x; __auto_type v_ty_3 = s2->u.C_El__Val.f_ty; __auto_type v_e_4 = s2->u.C_El__Val.f_e; ({ (void)(f_Emit__ctype(p_r, p_eff__Console, p_cx, f_Emit__gr(p_r, p_cx, p_fi, v_ty_3))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" ", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, ({ struct E_Emit__Name* o5 = (struct E_Emit__Name*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Name, u) + sizeof(((struct E_Emit__Name*)0)->u.C_Emit__L))); o5->tag = 1; o5->u.C_Emit__L.f_x = v_x_2; o5->u.C_Emit__L.f_n = f_Emit__envN(p_env); o5; }))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_e_4)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = f_Emit__bind(p_r, p_env, v_x_2); struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = p_drops; p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }) : s2->tag == 1 ? ({ __auto_type v_x_2 = s2->u.C_El__Handle.f_x; __auto_type v_h_3 = s2->u.C_El__Handle.f_h; __auto_type v_args_4 = s2->u.C_El__Handle.f_args; ({ struct E_Emit__Name* v_v_5 = ({ struct E_Emit__Name* o5 = (struct E_Emit__Name*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Name, u) + sizeof(((struct E_Emit__Name*)0)->u.C_Emit__L))); o5->tag = 1; o5->u.C_Emit__L.f_x = v_x_2; o5->u.C_Emit__L.f_n = f_Emit__envN(p_env); o5; }); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"srs_cap ", 8})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_5)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_v = { h_", 9})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_h_3)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_init(", 6})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__args(p_r, p_eff__Console, p_cx, p_fi, p_env, v_args_4, (&N_Emit__First))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"), vt_", 6})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_h_3)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", 1 }; srs_cap* ", 16})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_5)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = &", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_5)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_v; ", 4})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = f_Emit__bind(p_r, p_env, v_x_2); struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = ({ struct E_Coll__List__Emit__Drop* o6 = (struct E_Coll__List__Emit__Drop*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Emit__Drop, u) + sizeof(((struct E_Coll__List__Emit__Drop*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = ({ struct E_Emit__Drop* o6 = (struct E_Emit__Drop*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Drop, u) + sizeof(((struct E_Emit__Drop*)0)->u.C_Emit__Drop))); o6->tag = 0; o6->u.C_Emit__Drop.f_c = v_v_5; o6->u.C_Emit__Drop.f_proto = f_Emit__protoOfH(p_r, p_cx, v_h_3); o6; }); o6->u.C_Coll__Cons.f_t = p_drops; o6; }); p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }) : ({ __auto_type v_e_2 = s2->u.C_El__Do.f_e; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"(void)(", 7})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_e_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"); ", 3})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = p_drops; p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }); }); }); }); } +static int64_t f_Emit__block(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Fi* p_fi, struct E_Emit__Env* p_env, struct E_Emit__Pos* p_pos, struct E_Coll__List__El__Stmt* p_ss, struct E_El__Expr* p_last, struct E_Coll__List__Emit__Drop* p_drops) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"__auto_type res_ = ", 19})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, f_Emit__lastPos(p_drops, p_pos), p_last)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__drops(p_r, p_eff__Console, p_cx, p_drops)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"res_; })", 8})); p_eff__Console->live = 0; r_; }); res_; }); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_x_2 = s2->u.C_El__Val.f_x; __auto_type v_ty_3 = s2->u.C_El__Val.f_ty; __auto_type v_e_4 = s2->u.C_El__Val.f_e; ({ (void)(f_Emit__ctype(p_r, p_eff__Console, p_cx, f_Emit__gr(p_r, p_cx, p_fi, v_ty_3))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" ", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, ({ struct E_Emit__Name* o5 = (struct E_Emit__Name*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Name, u) + sizeof(((struct E_Emit__Name*)0)->u.C_Emit__L))); o5->tag = 1; o5->u.C_Emit__L.f_x = v_x_2; o5->u.C_Emit__L.f_n = f_Emit__envN(p_env); o5; }))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = ", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_e_4)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"; ", 2})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = f_Emit__bind(p_r, p_env, v_x_2); struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = p_drops; p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }) : s2->tag == 1 ? ({ __auto_type v_x_2 = s2->u.C_El__Handle.f_x; __auto_type v_h_3 = s2->u.C_El__Handle.f_h; __auto_type v_caps_4 = s2->u.C_El__Handle.f_caps; __auto_type v_args_5 = s2->u.C_El__Handle.f_args; ({ struct E_Emit__Name* v_v_6 = ({ struct E_Emit__Name* o6 = (struct E_Emit__Name*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Name, u) + sizeof(((struct E_Emit__Name*)0)->u.C_Emit__L))); o6->tag = 1; o6->u.C_Emit__L.f_x = v_x_2; o6->u.C_Emit__L.f_n = f_Emit__envN(p_env); o6; }); (void)(f_Emit__handleEnv(p_r, p_eff__Console, p_cx, p_fi, p_env, v_v_6, v_h_3, v_caps_4, v_args_5)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"srs_cap ", 8})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_6)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_v = { ", 7})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type s7 = v_caps_4; s7->tag == 0 ? ({ f_Emit__initCall(p_r, p_eff__Console, p_cx, p_fi, p_env, v_h_3, v_caps_4, v_args_5); }) : ({ ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"&", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_6)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_e", 2})); p_eff__Console->live = 0; r_; }); res_; }); }); })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", vt_", 5})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_h_3)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", 1 }; srs_cap* ", 16})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_6)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" = &", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_6)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_v; ", 4})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = f_Emit__bind(p_r, p_env, v_x_2); struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = ({ struct E_Coll__List__Emit__Drop* o7 = (struct E_Coll__List__Emit__Drop*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Emit__Drop, u) + sizeof(((struct E_Coll__List__Emit__Drop*)0)->u.C_Coll__Cons))); o7->tag = 1; o7->u.C_Coll__Cons.f_h = ({ struct E_Emit__Drop* o7 = (struct E_Emit__Drop*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Drop, u) + sizeof(((struct E_Emit__Drop*)0)->u.C_Emit__Drop))); o7->tag = 0; o7->u.C_Emit__Drop.f_c = v_v_6; o7->u.C_Emit__Drop.f_proto = f_Emit__protoOfH(p_r, p_cx, v_h_3); o7; }); o7->u.C_Coll__Cons.f_t = p_drops; o7; }); p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }) : ({ __auto_type v_e_2 = s2->u.C_El__Do.f_e; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"(void)(", 7})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ex(p_r, p_eff__Console, p_cx, p_fi, p_env, (&N_Emit__Inner), v_e_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"); ", 3})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Fi* t3 = p_fi; struct E_Emit__Env* t4 = p_env; struct E_Emit__Pos* t5 = p_pos; struct E_Coll__List__El__Stmt* t6 = v_rest_1; struct E_El__Expr* t7 = p_last; struct E_Coll__List__Emit__Drop* t8 = p_drops; p_r = t0; p_eff__Console = t1; p_cx = t2; p_fi = t3; p_env = t4; p_pos = t5; p_ss = t6; p_last = t7; p_drops = t8; goto srs_tail; (int64_t){0}; }); res_; }); }); }); }); }); } static struct E_Emit__Pos* f_Emit__lastPos(struct E_Coll__List__Emit__Drop* p_drops, struct E_Emit__Pos* p_pos) { return ({ __auto_type s0 = p_drops; s0->tag == 0 ? ({ p_pos; }) : ({ (&N_Emit__Inner); }); }); } static int64_t f_Emit__drops(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__Emit__Drop* p_ds) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_d_0; ({ __auto_type v_v_2 = s2->u.C_Emit__Drop.f_c; __auto_type v_p_3 = s2->u.C_Emit__Drop.f_proto; ({ __auto_type res_ = ({ __auto_type s4 = p_cx; ({ __auto_type v_ps_4 = s4->u.C_Emit__Cx.f_protos; ({ (void)(({ __auto_type s5 = f_Coll__sLookup__Ast__Proto(p_r, v_ps_4, v_p_3); s5->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_pr_5 = s5->u.C_Coll__Some.f_v; ({ __auto_type res_ = ({ __auto_type s6 = v_pr_5; ({ __auto_type v_dop_6 = s6->u.C_Ast__Proto.f_dropOp; __auto_type v_ops_7 = s6->u.C_Ast__Proto.f_ops; ({ __auto_type res_ = ({ __auto_type s8 = v_dop_6; s8->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_o_8 = s8->u.C_Coll__Some.f_v; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"if (", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"->live) ((int64_t(*)(void*))(", 29})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"->vt[", 5})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, f_Emit__opIn(v_ops_7, v_o_8, ((int64_t)0))); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"]))(", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__cname(p_eff__Console, v_v_2)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"->self); ", 9})); p_eff__Console->live = 0; r_; }); res_; }); }); }); res_; }); }); }); res_; }); }); })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Coll__List__Emit__Drop* t3 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_ds = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } static struct E_Sym__Sym* f_Emit__protoOfH(srs_cap* p_r, struct E_Emit__Cx* p_cx, struct E_Sym__Sym* p_h) { return ({ __auto_type res_ = ({ __auto_type s0 = p_cx; ({ __auto_type v_hp_0 = s0->u.C_Emit__Cx.f_hprotos; ({ __auto_type res_ = ({ __auto_type s1 = f_Coll__sLookup__Sym__Sym(p_r, v_hp_0, p_h); s1->tag == 1 ? ({ __auto_type v_p_1 = s1->u.C_Coll__Some.f_v; v_p_1; }) : ({ p_h; }); }); res_; }); }); }); res_; }); } @@ -3933,11 +3945,16 @@ static int64_t f_Emit__protos(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Em static int64_t f_Emit__bodies(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__Mono__Inst* p_is) { srs_tail: return ({ __auto_type s0 = p_is; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_i_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_i_0; ({ __auto_type v_f_2 = s2->u.C_Mono__Inst.f_f; ({ __auto_type res_ = ({ __auto_type s3 = v_f_2; ({ __auto_type v_body_3 = s3->u.C_El__Fn.f_body; ({ (void)(({ __auto_type s4 = v_body_3; s4->tag == 0 ? ({ __auto_type v_e_4 = s4->u.C_El__Def.f_e; f_Emit__body(p_r, p_eff__Console, p_cx, f_Emit__fiOf(p_r, p_cx, v_i_0), f_Emit__kindOf(p_r, v_i_0), v_e_4); }) : ({ ((int64_t)0); }); })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Coll__List__Mono__Inst* t3 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_is = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } static int64_t f_Emit__handlers(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__El__Handler* p_hs, struct E_Emit__Part* p_what) { srs_tail: return ({ __auto_type s0 = p_hs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_h_0; ({ __auto_type v_hn_2 = s2->u.C_El__Handler.f_name; __auto_type v_fs_3 = s2->u.C_El__Handler.f_fns; ({ (void)(f_Emit__implFns(p_r, p_eff__Console, p_cx, ({ struct E_Emit__Kind* o4 = (struct E_Emit__Kind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Kind, u) + sizeof(((struct E_Emit__Kind*)0)->u.C_Emit__KHandler))); o4->tag = 2; o4->u.C_Emit__KHandler.f_h = v_hn_2; o4; }), v_fs_3, p_what)); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Coll__List__El__Handler* t3 = v_rest_1; struct E_Emit__Part* t4 = p_what; p_r = t0; p_eff__Console = t1; p_cx = t2; p_hs = t3; p_what = t4; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); } static int64_t f_Emit__implFns(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Emit__Kind* p_k, struct E_Coll__List__El__Fn* p_fs, struct E_Emit__Part* p_what) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_f_0; ({ __auto_type v_body_2 = s2->u.C_El__Fn.f_body; ({ struct E_Emit__Fi* v_fi_3 = f_Emit__fiOf(p_r, p_cx, ({ struct E_Mono__Inst* o3 = (struct E_Mono__Inst*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Mono__Inst, u) + sizeof(((struct E_Mono__Inst*)0)->u.C_Mono__Inst))); o3->tag = 0; o3->u.C_Mono__Inst.f_f = v_f_0; o3->u.C_Mono__Inst.f_sub = (&N_Coll__Nil__Ty__Bind); o3->u.C_Mono__Inst.f_site = (&N_Mono__Top); o3; })); (void)(({ __auto_type s4 = p_what; s4->tag == 0 ? ({ ({ (void)(f_Emit__sig(p_r, p_eff__Console, p_cx, v_fi_3, p_k)); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)";\n", 2})); p_eff__Console->live = 0; r_; }); res_; }); }) : ({ ({ __auto_type s4 = v_body_2; s4->tag == 0 ? ({ __auto_type v_e_4 = s4->u.C_El__Def.f_e; f_Emit__body(p_r, p_eff__Console, p_cx, v_fi_3, p_k, v_e_4); }) : ({ ((int64_t)0); }); }); }); })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Emit__Kind* t3 = p_k; struct E_Coll__List__El__Fn* t4 = v_rest_1; struct E_Emit__Part* t5 = p_what; p_r = t0; p_eff__Console = t1; p_cx = t2; p_k = t3; p_fs = t4; p_what = t5; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); } -static int64_t f_Emit__vtables(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__El__Handler* p_hs) { srs_tail: return ({ __auto_type s0 = p_hs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_h_0; ({ __auto_type v_hn_2 = s2->u.C_El__Handler.f_name; __auto_type v_p_3 = s2->u.C_El__Handler.f_proto; ({ __auto_type res_ = ({ __auto_type s4 = p_cx; ({ __auto_type v_ps_4 = s4->u.C_Emit__Cx.f_protos; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"static void* const vt_", 22})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_hn_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"[] = {", 6})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type s5 = f_Coll__sLookup__Ast__Proto(p_r, v_ps_4, v_p_3); s5->tag == 1 ? ({ __auto_type v_pr_5 = s5->u.C_Coll__Some.f_v; ({ __auto_type res_ = ({ __auto_type s6 = v_pr_5; ({ __auto_type v_ops_6 = s6->u.C_Ast__Proto.f_ops; ({ __auto_type res_ = f_Emit__vtOps(p_eff__Console, v_hn_2, v_ops_6); res_; }); }); }); res_; }); }) : ({ ((int64_t)0); }); })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" 0 };\n", 6})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Coll__List__El__Handler* t3 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_hs = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } -static int64_t f_Emit__vtOps(srs_cap* p_eff__Console, struct E_Sym__Sym* p_hn, struct E_Coll__List__Ast__Op* p_ops) { srs_tail: return ({ __auto_type s0 = p_ops; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_o_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_o_0; ({ __auto_type v_n_2 = s2->u.C_Ast__Op.f_name; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" (void*)h_", 10})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_hn)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_n_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)",", 1})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_eff__Console; struct E_Sym__Sym* t1 = p_hn; struct E_Coll__List__Ast__Op* t2 = v_rest_1; p_eff__Console = t0; p_hn = t1; p_ops = t2; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); } +static int64_t f_Emit__vtables(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Coll__List__El__Handler* p_hs) { srs_tail: return ({ __auto_type s0 = p_hs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_h_0; ({ __auto_type v_hn_2 = s2->u.C_El__Handler.f_name; __auto_type v_p_3 = s2->u.C_El__Handler.f_proto; __auto_type v_fs_4 = s2->u.C_El__Handler.f_fns; ({ __auto_type res_ = ({ __auto_type s5 = p_cx; ({ __auto_type v_ps_5 = s5->u.C_Emit__Cx.f_protos; ({ srs_str v_pre_6 = (f_Emit__hasRow(v_fs_4) ? ((srs_str){(const uint8_t*)"w_", 2}) : ((srs_str){(const uint8_t*)"h_", 2})); (void)(f_Emit__wrappers(p_r, p_eff__Console, p_cx, v_hn_2, v_fs_4)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"static void* const vt_", 22})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_hn_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"[] = {", 6})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type s7 = f_Coll__sLookup__Ast__Proto(p_r, v_ps_5, v_p_3); s7->tag == 1 ? ({ __auto_type v_pr_7 = s7->u.C_Coll__Some.f_v; ({ __auto_type res_ = ({ __auto_type s8 = v_pr_7; ({ __auto_type v_ops_8 = s8->u.C_Ast__Proto.f_ops; ({ __auto_type res_ = f_Emit__vtOps(p_eff__Console, v_pre_6, v_hn_2, v_ops_8); res_; }); }); }); res_; }); }) : ({ ((int64_t)0); }); })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" 0 };\n", 6})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Coll__List__El__Handler* t3 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_hs = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); } +static bool f_Emit__hasRow(struct E_Coll__List__El__Fn* p_fs) { return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ false; }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; ({ __auto_type res_ = ({ __auto_type s1 = v_f_0; ({ __auto_type v_caps_1 = s1->u.C_El__Fn.f_caps; ({ __auto_type res_ = (f_Coll__length__Sym__Sym(v_caps_1) > ((int64_t)0)); res_; }); }); }); res_; }); }); }); } +static int64_t f_Emit__wrappers(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx, struct E_Sym__Sym* p_hn, struct E_Coll__List__El__Fn* p_fs) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_f_0; ({ __auto_type v_name_2 = s2->u.C_El__Fn.f_name; __auto_type v_caps_3 = s2->u.C_El__Fn.f_caps; ({ (void)((((f_Coll__length__Sym__Sym(v_caps_3) > ((int64_t)0)) && (!Str__eq(f_Sym__str(v_name_2), ((srs_str){(const uint8_t*)"init", 4})))) ? ({ __auto_type res_ = ({ __auto_type s4 = f_Emit__fiOf(p_r, p_cx, ({ struct E_Mono__Inst* o4 = (struct E_Mono__Inst*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Mono__Inst, u) + sizeof(((struct E_Mono__Inst*)0)->u.C_Mono__Inst))); o4->tag = 0; o4->u.C_Mono__Inst.f_f = v_f_0; o4->u.C_Mono__Inst.f_sub = (&N_Coll__Nil__Ty__Bind); o4->u.C_Mono__Inst.f_site = (&N_Mono__Top); o4; })); ({ __auto_type v_slots_4 = s4->u.C_Emit__Fi.f_slots; __auto_type v_ret_5 = s4->u.C_Emit__Fi.f_ret; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"static ", 7})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__ctype(p_r, p_eff__Console, p_cx, v_ret_5)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" w_", 3})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_hn)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_name_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"(void* e_", 9})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__params(p_r, p_eff__Console, p_cx, f_Emit__opSlots(v_slots_4), (&N_Emit__Comma))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)") { srs_env* e = (srs_env*)e_; return h_", 40})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_hn)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_name_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"(", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__envCaps(p_eff__Console, ((int64_t)0), f_Coll__length__Sym__Sym(v_caps_3))); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"e->st", 5})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__slotArgs(p_eff__Console, f_Emit__opSlots(v_slots_4))); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"); }\n", 5})); p_eff__Console->live = 0; r_; }); res_; }); }); }); res_; }) : ((int64_t)0))); __auto_type res_ = ({ srs_cap* t0 = p_r; srs_cap* t1 = p_eff__Console; struct E_Emit__Cx* t2 = p_cx; struct E_Sym__Sym* t3 = p_hn; struct E_Coll__List__El__Fn* t4 = v_rest_1; p_r = t0; p_eff__Console = t1; p_cx = t2; p_hn = t3; p_fs = t4; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); } +static struct E_Coll__List__Emit__Slot* f_Emit__opSlots(struct E_Coll__List__Emit__Slot* p_slots) { srs_tail: return ({ __auto_type s0 = p_slots; s0->tag == 0 ? ({ (&N_Coll__Nil__Emit__Slot); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ ({ struct E_Coll__List__Emit__Slot* t0 = v_rest_1; p_slots = t0; goto srs_tail; (struct E_Coll__List__Emit__Slot*){0}; }); }) : ({ v_rest_1; }); }); }); }); } +static int64_t f_Emit__envCaps(srs_cap* p_eff__Console, int64_t p_i, int64_t p_n) { srs_tail: return ({ __auto_type res_ = ((p_i < p_n) ? ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"e->c[", 5})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, p_i); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"], ", 3})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_eff__Console; int64_t t1 = (p_i + ((int64_t)1)); int64_t t2 = p_n; p_eff__Console = t0; p_i = t1; p_n = t2; goto srs_tail; (int64_t){0}; }); res_; }) : ((int64_t)0)); res_; }); } +static int64_t f_Emit__slotArgs(srs_cap* p_eff__Console, struct E_Coll__List__Emit__Slot* p_slots) { srs_tail: return ({ __auto_type s0 = p_slots; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)", p_", 4})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, f_Emit__slotName(v_s_0))); __auto_type res_ = ({ srs_cap* t0 = p_eff__Console; struct E_Coll__List__Emit__Slot* t1 = v_rest_1; p_eff__Console = t0; p_slots = t1; goto srs_tail; (int64_t){0}; }); res_; }); }); }); } +static int64_t f_Emit__vtOps(srs_cap* p_eff__Console, srs_str p_pre, struct E_Sym__Sym* p_hn, struct E_Coll__List__Ast__Op* p_ops) { srs_tail: return ({ __auto_type s0 = p_ops; s0->tag == 0 ? ({ ((int64_t)0); }) : ({ __auto_type v_o_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_o_0; ({ __auto_type v_n_2 = s2->u.C_Ast__Op.f_name; ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" (void*)", 8})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, p_pre); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, p_hn)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"_", 1})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__id(p_eff__Console, v_n_2)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)",", 1})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ srs_cap* t0 = p_eff__Console; srs_str t1 = p_pre; struct E_Sym__Sym* t2 = p_hn; struct E_Coll__List__Ast__Op* t3 = v_rest_1; p_eff__Console = t0; p_pre = t1; p_hn = t2; p_ops = t3; goto srs_tail; (int64_t){0}; }); res_; }); }); }); res_; }); }); }); } static int64_t f_Emit__allocFast(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Emit__Cx* p_cx) { return ({ (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct srs_chunk { struct srs_chunk* next; size_t used, cap; } srs_chunk;\n", 82})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"static inline void* srs_alloc(srs_cap* c, int64_t size) {\n", 58})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" if (c->vt == vt_Arena) {\n", 27})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" srs_chunk* h = *(srs_chunk**)c->self;\n", 42})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" size_t n = ((size_t)size + 15) & ~(size_t)15;\n", 50})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" if (h && h->used + n <= h->cap) { void* p = (char*)(h + 1) + h->used; h->used += n; return p; }\n", 100})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" return rt_arena_alloc(c->self, size);\n", 42})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" }\n", 4})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)" return ((void*(*)(void*, int64_t))c->vt[", 42})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, int64_t))(p_eff__Console->vt[1]))(p_eff__Console->self, f_Emit__opIndex(p_r, p_cx, f_Sym__of(p_r, ((srs_str){(const uint8_t*)"Region", 6})), f_Sym__of(p_r, ((srs_str){(const uint8_t*)"alloc", 5})))); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"])(c->self, size);\n", 19})); p_eff__Console->live = 0; r_; })); __auto_type res_ = ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"}\n", 2})); p_eff__Console->live = 0; r_; }); res_; }); } static bool f_Emit__hasMain(srs_cap* p_r, struct E_Emit__Cx* p_cx) { return ({ __auto_type res_ = ({ __auto_type s0 = p_cx; ({ __auto_type v_fns_0 = s0->u.C_Emit__Cx.f_fns; ({ __auto_type res_ = ({ __auto_type s1 = f_Coll__sLookup__El__Fn(p_r, v_fns_0, f_Sym__of(p_r, ((srs_str){(const uint8_t*)"main", 4}))); s1->tag == 1 ? ({ true; }) : ({ false; }); }); res_; }); }); }); res_; }); } -static int64_t f_Emit__program(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Coll__List__Ast__Decl* p_ds, struct E_Ty__Result* p_res) { return ({ __auto_type res_ = ({ __auto_type s0 = p_res; ({ __auto_type v_s_0 = s0->u.C_Ty__Result.f_s; __auto_type v_fs_1 = s0->u.C_Ty__Result.f_fns; __auto_type v_hs_2 = s0->u.C_Ty__Result.f_hs; ({ struct E_Emit__Cx* v_cx_3 = f_Emit__cxOf(p_r, p_ds, v_s_0, v_fs_1); struct E_Coll__List__Mono__Inst* v_is_4 = f_Mono__run(p_r, p_res); struct E_Coll__List__K__Term* v_ens_5 = f_Emit__closeEnums(p_r, v_cx_3, f_Emit__instTys(p_r, v_cx_3, v_is_4, (&N_Coll__Nil__K__Term)), (&N_Coll__BTip__Coll__List_1_K__Term), (&N_Coll__Nil__K__Term)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"// DO-NOT-EDIT. Generated by srs (s2/emit.srs).\n", 48})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"#include \n#include \n#include \n", 61})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct { const uint8_t* p; int64_t n; } srs_str;\n", 57})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct { void* self; void* const* vt; int64_t live; } srs_cap;\n", 71})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"void rt_init(int argc, char** argv);\n", 37})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__fwds(p_eff__Console, v_ens_5)); (void)(f_Emit__structs(p_r, p_eff__Console, v_cx_3, v_ens_5)); (void)(f_Emit__statics(p_r, p_eff__Console, v_cx_3, v_ens_5)); (void)(f_Emit__externs(p_r, p_eff__Console, v_cx_3, v_fs_1)); (void)(f_Emit__protos(p_r, p_eff__Console, v_cx_3, v_is_4)); (void)(f_Emit__handlers(p_r, p_eff__Console, v_cx_3, v_hs_2, (&N_Emit__Layout))); (void)(f_Emit__vtables(p_r, p_eff__Console, v_cx_3, v_hs_2)); __auto_type res_ = ({ __auto_type s6 = v_cx_3; ({ __auto_type v_al_6 = s6->u.C_Emit__Cx.f_alloc; ({ (void)(({ __auto_type s7 = v_al_6; s7->tag == 0 ? ({ f_Emit__allocFast(p_r, p_eff__Console, v_cx_3); }) : ({ ((int64_t)0); }); })); (void)(f_Emit__bodies(p_r, p_eff__Console, v_cx_3, v_is_4)); (void)(f_Emit__handlers(p_r, p_eff__Console, v_cx_3, v_hs_2, (&N_Emit__Code))); __auto_type res_ = (f_Emit__hasMain(p_r, v_cx_3) ? ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"int main(int argc, char** argv) { rt_init(argc, argv); return (int)f_main(); }\n", 79})); p_eff__Console->live = 0; r_; }) : ((int64_t)0)); res_; }); }); }); res_; }); }); }); res_; }); } +static int64_t f_Emit__program(srs_cap* p_r, srs_cap* p_eff__Console, struct E_Coll__List__Ast__Decl* p_ds, struct E_Ty__Result* p_res) { return ({ __auto_type res_ = ({ __auto_type s0 = p_res; ({ __auto_type v_s_0 = s0->u.C_Ty__Result.f_s; __auto_type v_fs_1 = s0->u.C_Ty__Result.f_fns; __auto_type v_hs_2 = s0->u.C_Ty__Result.f_hs; ({ struct E_Emit__Cx* v_cx_3 = f_Emit__cxOf(p_r, p_ds, v_s_0, v_fs_1); struct E_Coll__List__Mono__Inst* v_is_4 = f_Mono__run(p_r, p_res); struct E_Coll__List__K__Term* v_ens_5 = f_Emit__closeEnums(p_r, v_cx_3, f_Emit__instTys(p_r, v_cx_3, v_is_4, (&N_Coll__Nil__K__Term)), (&N_Coll__BTip__Coll__List_1_K__Term), (&N_Coll__Nil__K__Term)); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"// DO-NOT-EDIT. Generated by srs (s2/emit.srs).\n", 48})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"#include \n#include \n#include \n", 61})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct { const uint8_t* p; int64_t n; } srs_str;\n", 57})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct { void* self; void* const* vt; int64_t live; } srs_cap;\n", 71})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"typedef struct { void* st; srs_cap* c[]; } srs_env;\n", 52})); p_eff__Console->live = 0; r_; })); (void)(({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"void rt_init(int argc, char** argv);\n", 37})); p_eff__Console->live = 0; r_; })); (void)(f_Emit__fwds(p_eff__Console, v_ens_5)); (void)(f_Emit__structs(p_r, p_eff__Console, v_cx_3, v_ens_5)); (void)(f_Emit__statics(p_r, p_eff__Console, v_cx_3, v_ens_5)); (void)(f_Emit__externs(p_r, p_eff__Console, v_cx_3, v_fs_1)); (void)(f_Emit__protos(p_r, p_eff__Console, v_cx_3, v_is_4)); (void)(f_Emit__handlers(p_r, p_eff__Console, v_cx_3, v_hs_2, (&N_Emit__Layout))); (void)(f_Emit__vtables(p_r, p_eff__Console, v_cx_3, v_hs_2)); __auto_type res_ = ({ __auto_type s6 = v_cx_3; ({ __auto_type v_al_6 = s6->u.C_Emit__Cx.f_alloc; ({ (void)(({ __auto_type s7 = v_al_6; s7->tag == 0 ? ({ f_Emit__allocFast(p_r, p_eff__Console, v_cx_3); }) : ({ ((int64_t)0); }); })); (void)(f_Emit__bodies(p_r, p_eff__Console, v_cx_3, v_is_4)); (void)(f_Emit__handlers(p_r, p_eff__Console, v_cx_3, v_hs_2, (&N_Emit__Code))); __auto_type res_ = (f_Emit__hasMain(p_r, v_cx_3) ? ({ __auto_type r_ = ((int64_t(*)(void*, srs_str))(p_eff__Console->vt[0]))(p_eff__Console->self, ((srs_str){(const uint8_t*)"int main(int argc, char** argv) { rt_init(argc, argv); return (int)f_main(); }\n", 79})); p_eff__Console->live = 0; r_; }) : ((int64_t)0)); res_; }); }); }); res_; }); }); }); res_; }); } static struct E_Emit__Kind* f_Emit__kindOf(srs_cap* p_r, struct E_Mono__Inst* p_i) { return ({ __auto_type res_ = ({ __auto_type s0 = p_i; ({ __auto_type v_site_0 = s0->u.C_Mono__Inst.f_site; ({ __auto_type res_ = ({ __auto_type s1 = v_site_0; s1->tag == 0 ? ({ (&N_Emit__KDef); }) : ({ __auto_type v_goal_1 = s1->u.C_Mono__Impl.f_goal; ({ struct E_Emit__Kind* o2 = (struct E_Emit__Kind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Emit__Kind, u) + sizeof(((struct E_Emit__Kind*)0)->u.C_Emit__KGiven))); o2->tag = 3; o2->u.C_Emit__KGiven.f_head = v_goal_1; o2; }); }); }); res_; }); }); }); res_; }); } static int64_t f_Ev__fuel(void) { return ((int64_t)1000000); } static struct E_Ev__Cx* f_Ev__cxOf(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__SMap__Bool* p_imp) { return f_Ev__cxDecls(p_r, p_ds, ({ struct E_Ev__Cx* o0 = (struct E_Ev__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ev__Cx, u) + sizeof(((struct E_Ev__Cx*)0)->u.C_Ev__Cx))); o0->tag = 0; o0->u.C_Ev__Cx.f_fns = f_Coll__sEmpty__Ast__Fn(p_r); o0->u.C_Ev__Cx.f_cases = f_Coll__sEmpty__I64(p_r); o0->u.C_Ev__Cx.f_impure = p_imp; o0; })); } @@ -4818,8 +4835,8 @@ static struct E_Coll__Option__Pure__Prim* f_Pure__prim(srs_cap* p_r, struct E_Sy static struct E_Coll__List__D__Fact* f_Pure__facts(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Eff__Rows* p_rows) { return f_Pure__decls(p_r, f_Pure__protos(p_r, p_ds, (&N_Coll__Nil__Sym__Sym)), f_Pure__hprotos(p_r, p_ds, f_Coll__sEmpty__Sym__Sym(p_r)), p_rows, p_ds, (&N_Coll__Nil__D__Fact)); } static struct E_Coll__List__Sym__Sym* f_Pure__protos(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__Sym__Sym* p_acc) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 2 ? ({ __auto_type v_p_2 = s2->u.C_Ast__DProto.f_p; ({ __auto_type res_ = ({ __auto_type s3 = v_p_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Proto.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Coll__List__Sym__Sym* t2 = ({ struct E_Coll__List__Sym__Sym* o4 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_n_3; o4->u.C_Coll__Cons.f_t = p_acc; o4; }); p_r = t0; p_ds = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Sym__Sym*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Coll__List__Sym__Sym* t2 = p_acc; p_r = t0; p_ds = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Sym__Sym*){0}; }); }); }); }); }); } static struct E_Coll__SMap__Sym__Sym* f_Pure__hprotos(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__SMap__Sym__Sym* p_m) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_m; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = v_h_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Handler.f_name; __auto_type v_p_4 = s3->u.C_Ast__Handler.f_proto; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Coll__SMap__Sym__Sym* t2 = f_Coll__sInsert__Sym__Sym(p_r, p_m, v_n_3, v_p_4); p_r = t0; p_ds = t1; p_m = t2; goto srs_tail; (struct E_Coll__SMap__Sym__Sym*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Decl* t1 = v_rest_1; struct E_Coll__SMap__Sym__Sym* t2 = p_m; p_r = t0; p_ds = t1; p_m = t2; goto srs_tail; (struct E_Coll__SMap__Sym__Sym*){0}; }); }); }); }); }); } -static struct E_Coll__List__D__Fact* f_Pure__decls(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Eff__Rows* p_rows, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = v_f_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = f_Pure__rowUses(p_r, v_n_3, f_Eff__row(p_r, p_rows, v_n_3), f_Pure__fn(p_r, p_ps, p_hp, ({ struct E_Pure__Who* o4 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__Def))); o4->tag = 0; o4->u.C_Pure__Def.f_f = v_n_3; o4; }), v_f_2, p_acc)); p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = v_h_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Handler.f_name; __auto_type v_p_4 = s3->u.C_Ast__Handler.f_proto; __auto_type v_fs_5 = s3->u.C_Ast__Handler.f_fns; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = f_Pure__fns(p_r, p_ps, p_hp, ({ struct E_Pure__Who* o6 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__In))); o6->tag = 1; o6->u.C_Pure__In.f_h = v_n_3; o6; }), v_fs_5, ({ struct E_Coll__List__D__Fact* o6 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = f_Pure__f2(p_r, (&N_Pure__RHandles), v_n_3, v_p_4); o6->u.C_Coll__Cons.f_t = p_acc; o6; })); p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = p_acc; p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); }); }); }); }); } -static struct E_Coll__List__D__Fact* f_Pure__rowUses(srs_cap* p_r, struct E_Sym__Sym* p_f, struct E_Coll__List__Eff__Cap* p_cs, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_cs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_c_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_c_0; ({ __auto_type v_p_2 = s2->u.C_Eff__Cap.f_p; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Sym__Sym* t1 = p_f; struct E_Coll__List__Eff__Cap* t2 = v_rest_1; struct E_Coll__List__D__Fact* t3 = ({ struct E_Coll__List__D__Fact* o3 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = f_Pure__f2(p_r, (&N_Pure__RUses), p_f, v_p_2); o3->u.C_Coll__Cons.f_t = p_acc; o3; }); p_r = t0; p_f = t1; p_cs = t2; p_acc = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }); }); } +static struct E_Coll__List__D__Fact* f_Pure__decls(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Eff__Rows* p_rows, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = v_f_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = f_Pure__rowUses(p_r, ({ struct E_Pure__Who* o4 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__Def))); o4->tag = 0; o4->u.C_Pure__Def.f_f = v_n_3; o4; }), f_Eff__row(p_r, p_rows, v_n_3), f_Pure__fn(p_r, p_ps, p_hp, ({ struct E_Pure__Who* o4 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__Def))); o4->tag = 0; o4->u.C_Pure__Def.f_f = v_n_3; o4; }), v_f_2, p_acc)); p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = v_h_2; ({ __auto_type v_n_3 = s3->u.C_Ast__Handler.f_name; __auto_type v_p_4 = s3->u.C_Ast__Handler.f_proto; __auto_type v_fs_5 = s3->u.C_Ast__Handler.f_fns; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = f_Pure__rowUses(p_r, ({ struct E_Pure__Who* o6 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__In))); o6->tag = 1; o6->u.C_Pure__In.f_h = v_n_3; o6; }), f_Eff__row(p_r, p_rows, v_n_3), f_Pure__fns(p_r, p_ps, p_hp, ({ struct E_Pure__Who* o6 = (struct E_Pure__Who*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Who, u) + sizeof(((struct E_Pure__Who*)0)->u.C_Pure__In))); o6->tag = 1; o6->u.C_Pure__In.f_h = v_n_3; o6; }), v_fs_5, ({ struct E_Coll__List__D__Fact* o6 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = f_Pure__f2(p_r, (&N_Pure__RHandles), v_n_3, v_p_4); o6->u.C_Coll__Cons.f_t = p_acc; o6; }))); p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Eff__Rows* t3 = p_rows; struct E_Coll__List__Ast__Decl* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = p_acc; p_r = t0; p_ps = t1; p_hp = t2; p_rows = t3; p_ds = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); }); }); }); }); } +static struct E_Coll__List__D__Fact* f_Pure__rowUses(srs_cap* p_r, struct E_Pure__Who* p_w, struct E_Coll__List__Eff__Cap* p_cs, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_cs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_c_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_c_0; ({ __auto_type v_p_2 = s2->u.C_Eff__Cap.f_p; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Pure__Who* t1 = p_w; struct E_Coll__List__Eff__Cap* t2 = v_rest_1; struct E_Coll__List__D__Fact* t3 = ({ struct E_Coll__List__D__Fact* o3 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = f_Pure__f2(p_r, f_Pure__uses(p_w), f_Pure__subj(p_w), v_p_2); o3->u.C_Coll__Cons.f_t = p_acc; o3; }); p_r = t0; p_w = t1; p_cs = t2; p_acc = t3; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); res_; }); }); }); res_; }); }); }); } static struct E_Coll__List__D__Fact* f_Pure__fns(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Pure__Who* p_w, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Coll__SMap__Sym__Sym* t2 = p_hp; struct E_Pure__Who* t3 = p_w; struct E_Coll__List__Ast__Fn* t4 = v_rest_1; struct E_Coll__List__D__Fact* t5 = f_Pure__fn(p_r, p_ps, p_hp, p_w, v_f_0, p_acc); p_r = t0; p_ps = t1; p_hp = t2; p_w = t3; p_fs = t4; p_acc = t5; goto srs_tail; (struct E_Coll__List__D__Fact*){0}; }); }); }); } static struct E_Coll__List__D__Fact* f_Pure__fn(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Coll__SMap__Sym__Sym* p_hp, struct E_Pure__Who* p_w, struct E_Ast__Fn* p_f, struct E_Coll__List__D__Fact* p_acc) { return ({ __auto_type res_ = ({ __auto_type s0 = p_f; ({ __auto_type v_n_0 = s0->u.C_Ast__Fn.f_name; __auto_type v_gs_1 = s0->u.C_Ast__Fn.f_groups; __auto_type v_body_2 = s0->u.C_Ast__Fn.f_body; ({ __auto_type res_ = ({ __auto_type s3 = f_Pure__binders(p_r, p_ps, p_w, f_Ty__evidence(p_r, v_gs_1, (&N_Coll__Nil__Ast__Binder)), (&N_Coll__Nil__Sym__Sym), p_acc); ({ __auto_type v_ev_3 = s3->u.C_Pure__Ev.f_ev; __auto_type v_acc2_4 = s3->u.C_Pure__Ev.f_acc; ({ __auto_type res_ = ({ __auto_type s5 = v_body_2; s5->tag == 1 ? ({ (f_Pure__pureExtern(p_r, v_n_0) ? v_acc2_4 : ({ struct E_Coll__List__D__Fact* o5 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = f_Pure__f1(p_r, f_Pure__direct(p_w), f_Pure__subj(p_w)); o5->u.C_Coll__Cons.f_t = v_acc2_4; o5; })); }) : s5->tag == 0 ? ({ __auto_type v_e_5 = s5->u.C_Ast__Def.f_e; f_Pure__expr(p_r, p_hp, p_w, v_ev_3, v_e_5, v_acc2_4); }) : ({ __auto_type v_e_5 = s5->u.C_Ast__Spec.f_e; f_Pure__expr(p_r, p_hp, p_w, v_ev_3, v_e_5, v_acc2_4); }); }); res_; }); }); }); res_; }); }); }); res_; }); } static struct E_Pure__Ev* f_Pure__binders(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_ps, struct E_Pure__Who* p_w, struct E_Coll__List__Ast__Binder* p_bs, struct E_Coll__List__Sym__Sym* p_ev, struct E_Coll__List__D__Fact* p_acc) { srs_tail: return ({ __auto_type s0 = p_bs; s0->tag == 0 ? ({ ({ struct E_Pure__Ev* o0 = (struct E_Pure__Ev*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Ev, u) + sizeof(((struct E_Pure__Ev*)0)->u.C_Pure__Ev))); o0->tag = 0; o0->u.C_Pure__Ev.f_ev = p_ev; o0->u.C_Pure__Ev.f_acc = p_acc; o0; }); }) : ({ __auto_type v_b_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_b_0; ({ __auto_type v_x_2 = s2->u.C_Ast__Binder.f_x; __auto_type v_t_3 = s2->u.C_Ast__Binder.f_ty; ({ __auto_type res_ = ({ __auto_type s4 = v_t_3; ({ __auto_type v_tn_4 = s4->u.C_Ast__Ty.f_name; ({ __auto_type res_ = (f_Ty__memberSym(v_tn_4, p_ps) ? ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Pure__Who* t2 = p_w; struct E_Coll__List__Ast__Binder* t3 = v_rest_1; struct E_Coll__List__Sym__Sym* t4 = p_ev; struct E_Coll__List__D__Fact* t5 = ({ struct E_Coll__List__D__Fact* o5 = (struct E_Coll__List__D__Fact*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__D__Fact, u) + sizeof(((struct E_Coll__List__D__Fact*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = f_Pure__f2(p_r, f_Pure__uses(p_w), f_Pure__subj(p_w), v_tn_4); o5->u.C_Coll__Cons.f_t = p_acc; o5; }); p_r = t0; p_ps = t1; p_w = t2; p_bs = t3; p_ev = t4; p_acc = t5; goto srs_tail; (struct E_Pure__Ev*){0}; }) : ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = p_ps; struct E_Pure__Who* t2 = p_w; struct E_Coll__List__Ast__Binder* t3 = v_rest_1; struct E_Coll__List__Sym__Sym* t4 = ({ struct E_Coll__List__Sym__Sym* o5 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = v_x_2; o5->u.C_Coll__Cons.f_t = p_ev; o5; }); struct E_Coll__List__D__Fact* t5 = p_acc; p_r = t0; p_ps = t1; p_w = t2; p_bs = t3; p_ev = t4; p_acc = t5; goto srs_tail; (struct E_Pure__Ev*){0}; })); res_; }); }); }); res_; }); }); }); res_; }); }); }); } @@ -4982,7 +4999,7 @@ static struct E_Coll__List__El__Arm* f_Coll__rev__El__Arm(srs_cap* p_r, struct E static struct E_Coll__List__El__Arm* f_Coll__revOnto__El__Arm(srs_cap* p_r, struct E_Coll__List__El__Arm* p_xs, struct E_Coll__List__El__Arm* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__El__Arm* t1 = v_t_1; struct E_Coll__List__El__Arm* t2 = ({ struct E_Coll__List__El__Arm* o2 = (struct E_Coll__List__El__Arm*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Arm, u) + sizeof(((struct E_Coll__List__El__Arm*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_r = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__El__Arm*){0}; }); }); }); } static struct E_Ty__AEx* f_Ty__arm(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ty__Bind* p_bs, struct E_K__Term* p_ts, struct E_Ast__Arm* p_a, struct E_Coll__Option__K__Term* p_want) { return ({ __auto_type res_ = ({ __auto_type s0 = p_a; ({ __auto_type v_line_0 = s0->u.C_Ast__Arm.f_line; __auto_type v_p_1 = s0->u.C_Ast__Arm.f_p; __auto_type v_b_2 = s0->u.C_Ast__Arm.f_body; ({ __auto_type res_ = ({ __auto_type s3 = p_cx; ({ __auto_type v_es_3 = s3->u.C_Ty__Cx.f_es; ({ __auto_type res_ = ({ __auto_type s4 = ({ __auto_type s4 = v_p_1; s4->tag == 1 ? ({ f_Ty__expr(p_r, p_cx, p_st, p_bs, v_b_2, p_want); }) : ({ __auto_type v_c_4 = s4->u.C_Ast__PCase.f_c; __auto_type v_binds_5 = s4->u.C_Ast__PCase.f_binds; ({ __auto_type s6 = f_Ty__caseNamed(p_r, v_es_3, v_c_4); s6->tag == 0 ? ({ f_Ty__expr(p_r, p_cx, f_Ty__clash(p_r, p_st, ({ struct E_Ty__Clash* o6 = (struct E_Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Clash, u) + sizeof(((struct E_Ty__Clash*)0)->u.C_Ty__Unknown))); o6->tag = 1; o6->u.C_Ty__Unknown.f_line = v_line_0; o6->u.C_Ty__Unknown.f_name = v_c_4; o6; })), p_bs, v_b_2, p_want); }) : ({ __auto_type v_co_6 = s6->u.C_Coll__Some.f_v; ({ __auto_type res_ = ({ __auto_type s7 = v_co_6; ({ __auto_type v_e_7 = s7->u.C_Ty__CaseOf.f_e; __auto_type v_cs_8 = s7->u.C_Ty__CaseOf.f_c; ({ __auto_type res_ = ({ __auto_type s9 = v_cs_8; ({ __auto_type v_fields_9 = s9->u.C_Ast__Case.f_fields; ({ __auto_type res_ = ({ __auto_type s10 = f_Ty__openEnum(p_r, p_st, v_e_7); ({ __auto_type v_st1_10 = s10->u.C_Ty__Open.f_st; __auto_type v_tv_11 = s10->u.C_Ty__Open.f_tv; __auto_type v_vars_12 = s10->u.C_Ty__Open.f_vars; ({ struct E_Ty__St* v_st1b_13 = ((f_Coll__length__Sym__Sym(v_binds_5) == f_Coll__length__Ast__Binder(v_fields_9)) ? v_st1_10 : f_Ty__clash(p_r, v_st1_10, ({ struct E_Ty__Clash* o13 = (struct E_Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Clash, u) + sizeof(((struct E_Ty__Clash*)0)->u.C_Ty__PatArity))); o13->tag = 11; o13->u.C_Ty__PatArity.f_line = v_line_0; o13->u.C_Ty__PatArity.f_c = v_c_4; o13; }))); struct E_Ty__St* v_st2_14 = f_Ty__expect(p_r, v_st1b_13, v_line_0, p_ts, f_Ty__enumTerm(p_r, v_e_7, v_vars_12)); __auto_type res_ = f_Ty__expr(p_r, p_cx, v_st2_14, f_Ty__bindFields(p_r, v_binds_5, v_fields_9, v_tv_11, p_bs), v_b_2, p_want); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }); }); }); }); ({ __auto_type v_st9_4 = s4->u.C_Ty__Ex.f_st; __auto_type v_t9_5 = s4->u.C_Ty__Ex.f_t; __auto_type v_e9_6 = s4->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ struct E_Ty__AEx* o7 = (struct E_Ty__AEx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__AEx, u) + sizeof(((struct E_Ty__AEx*)0)->u.C_Ty__AEx))); o7->tag = 0; o7->u.C_Ty__AEx.f_st = v_st9_4; o7->u.C_Ty__AEx.f_t = v_t9_5; o7->u.C_Ty__AEx.f_a = ({ struct E_El__Arm* o7 = (struct E_El__Arm*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Arm, u) + sizeof(((struct E_El__Arm*)0)->u.C_El__Arm))); o7->tag = 0; o7->u.C_El__Arm.f_line = v_line_0; o7->u.C_El__Arm.f_p = v_p_1; o7->u.C_El__Arm.f_body = v_e9_6; o7; }); o7; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); } static struct E_Coll__List__Ty__Bind* f_Ty__bindFields(srs_cap* p_r, struct E_Coll__List__Sym__Sym* p_xs, struct E_Coll__List__Ast__Binder* p_fs, struct E_Coll__List__Ty__Bind* p_tv, struct E_Coll__List__Ty__Bind* p_bs) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_bs; }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = p_fs; s2->tag == 0 ? ({ p_bs; }) : ({ __auto_type v_f_2 = s2->u.C_Coll__Cons.f_h; __auto_type v_frest_3 = s2->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s4 = v_f_2; ({ __auto_type v_ft_4 = s4->u.C_Ast__Binder.f_ty; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Sym__Sym* t1 = v_rest_1; struct E_Coll__List__Ast__Binder* t2 = v_frest_3; struct E_Coll__List__Ty__Bind* t3 = p_tv; struct E_Coll__List__Ty__Bind* t4 = (Str__eq(f_Sym__str(v_x_0), ((srs_str){(const uint8_t*)"_", 1})) ? p_bs : ({ struct E_Coll__List__Ty__Bind* o5 = (struct E_Coll__List__Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Bind, u) + sizeof(((struct E_Coll__List__Ty__Bind*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_Ty__Bind* o5 = (struct E_Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Bind, u) + sizeof(((struct E_Ty__Bind*)0)->u.C_Ty__Bind))); o5->tag = 0; o5->u.C_Ty__Bind.f_x = v_x_0; o5->u.C_Ty__Bind.f_t = f_Ty__term(p_r, v_ft_4, p_tv); o5; }); o5->u.C_Coll__Cons.f_t = p_bs; o5; })); p_r = t0; p_xs = t1; p_fs = t2; p_tv = t3; p_bs = t4; goto srs_tail; (struct E_Coll__List__Ty__Bind*){0}; }); res_; }); }); }); res_; }); }); }); }); }); } -static struct E_Ty__Ex* f_Ty__block(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ty__Bind* p_bs, int64_t p_line, struct E_Coll__List__Ast__Stmt* p_ss, struct E_Ast__Expr* p_last, struct E_Coll__Option__K__Term* p_want, struct E_Coll__List__El__Stmt* p_acc) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ ({ __auto_type res_ = ({ __auto_type s0 = f_Ty__expr(p_r, p_cx, p_st, p_bs, p_last, p_want); ({ __auto_type v_st1_0 = s0->u.C_Ty__Ex.f_st; __auto_type v_t_1 = s0->u.C_Ty__Ex.f_t; __auto_type v_el_2 = s0->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ struct E_Ty__Ex* o3 = (struct E_Ty__Ex*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Ex, u) + sizeof(((struct E_Ty__Ex*)0)->u.C_Ty__Ex))); o3->tag = 0; o3->u.C_Ty__Ex.f_st = v_st1_0; o3->u.C_Ty__Ex.f_t = v_t_1; o3->u.C_Ty__Ex.f_e = ({ struct E_El__Expr* o3 = (struct E_El__Expr*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Expr, u) + sizeof(((struct E_El__Expr*)0)->u.C_El__Block))); o3->tag = 13; o3->u.C_El__Block.f_line = p_line; o3->u.C_El__Block.f_stmts = f_Coll__rev__El__Stmt(p_r, p_acc); o3->u.C_El__Block.f_last = v_el_2; o3; }); o3; }); res_; }); }); }); res_; }); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Val.f_line; __auto_type v_x_3 = s2->u.C_Ast__Val.f_x; __auto_type v_ann_4 = s2->u.C_Ast__Val.f_ann; __auto_type v_e_5 = s2->u.C_Ast__Val.f_e; f_Ty__bindStmt(p_r, p_cx, p_st, p_bs, p_line, v_sl_2, v_x_3, v_ann_4, v_e_5, false, v_rest_1, p_last, p_want, p_acc); }) : s2->tag == 1 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Var.f_line; __auto_type v_x_3 = s2->u.C_Ast__Var.f_x; __auto_type v_ann_4 = s2->u.C_Ast__Var.f_ann; __auto_type v_e_5 = s2->u.C_Ast__Var.f_e; f_Ty__bindStmt(p_r, p_cx, p_st, p_bs, p_line, v_sl_2, v_x_3, v_ann_4, v_e_5, true, v_rest_1, p_last, p_want, p_acc); }) : s2->tag == 2 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Handle.f_line; __auto_type v_x_3 = s2->u.C_Ast__Handle.f_x; __auto_type v_h_4 = s2->u.C_Ast__Handle.f_h; __auto_type v_xs_5 = s2->u.C_Ast__Handle.f_args; ({ __auto_type res_ = ({ __auto_type s6 = p_cx; ({ __auto_type v_hs_6 = s6->u.C_Ty__Cx.f_hs; __auto_type v_mode_7 = s6->u.C_Ty__Cx.f_mode; ({ __auto_type res_ = ({ __auto_type s8 = f_Ty__exprs(p_r, p_cx, f_Ty__pureHandle(p_r, v_mode_7, p_st, v_sl_2, v_h_4), p_bs, v_xs_5, (&N_Coll__Nil__El__Expr)); ({ __auto_type v_st1_8 = s8->u.C_Ty__Es.f_st; __auto_type v_eargs_9 = s8->u.C_Ty__Es.f_es; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_8; struct E_Coll__List__Ty__Bind* t3 = ({ struct E_Coll__List__Ty__Bind* o10 = (struct E_Coll__List__Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Bind, u) + sizeof(((struct E_Coll__List__Ty__Bind*)0)->u.C_Coll__Cons))); o10->tag = 1; o10->u.C_Coll__Cons.f_h = ({ struct E_Ty__Bind* o10 = (struct E_Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Bind, u) + sizeof(((struct E_Ty__Bind*)0)->u.C_Ty__Bind))); o10->tag = 0; o10->u.C_Ty__Bind.f_x = v_x_3; o10->u.C_Ty__Bind.f_t = ({ struct E_K__Term* o10 = (struct E_K__Term*)srs_alloc(p_r, (int64_t)(offsetof(struct E_K__Term, u) + sizeof(((struct E_K__Term*)0)->u.C_K__Con))); o10->tag = 1; o10->u.C_K__Con.f_f = f_Ty__protoOf(v_hs_6, v_h_4); o10->u.C_K__Con.f_args = (&N_Coll__Nil__K__Term); o10; }); o10; }); o10->u.C_Coll__Cons.f_t = p_bs; o10; }); int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = ({ struct E_Coll__List__El__Stmt* o10 = (struct E_Coll__List__El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Stmt, u) + sizeof(((struct E_Coll__List__El__Stmt*)0)->u.C_Coll__Cons))); o10->tag = 1; o10->u.C_Coll__Cons.f_h = ({ struct E_El__Stmt* o10 = (struct E_El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Stmt, u) + sizeof(((struct E_El__Stmt*)0)->u.C_El__Handle))); o10->tag = 1; o10->u.C_El__Handle.f_line = v_sl_2; o10->u.C_El__Handle.f_x = v_x_3; o10->u.C_El__Handle.f_h = v_h_4; o10->u.C_El__Handle.f_args = v_eargs_9; o10; }); o10->u.C_Coll__Cons.f_t = p_acc; o10; }); p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_e_2 = s2->u.C_Ast__Do.f_e; ({ __auto_type res_ = ({ __auto_type s3 = f_Ty__expr(p_r, p_cx, p_st, p_bs, v_e_2, (&N_Coll__None__K__Term)); ({ __auto_type v_st1_3 = s3->u.C_Ty__Ex.f_st; __auto_type v_ee_4 = s3->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_3; struct E_Coll__List__Ty__Bind* t3 = p_bs; int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = ({ struct E_Coll__List__El__Stmt* o5 = (struct E_Coll__List__El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Stmt, u) + sizeof(((struct E_Coll__List__El__Stmt*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_El__Stmt* o5 = (struct E_El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Stmt, u) + sizeof(((struct E_El__Stmt*)0)->u.C_El__Do))); o5->tag = 2; o5->u.C_El__Do.f_e = v_ee_4; o5; }); o5->u.C_Coll__Cons.f_t = p_acc; o5; }); p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }) : ({ __auto_type v_k_2 = s2->u.C_Ast__Check.f_k; __auto_type v_e_3 = s2->u.C_Ast__Check.f_e; ({ struct E_K__Term* v_want2_4 = ({ __auto_type s4 = v_k_2; s4->tag == 0 ? ({ f_Ty__con(p_r, ((srs_str){(const uint8_t*)"Bool", 4})); }) : ({ f_Ty__con(p_r, ((srs_str){(const uint8_t*)"I64", 3})); }); }); __auto_type res_ = ({ __auto_type s5 = f_Ty__expr(p_r, p_cx, p_st, p_bs, v_e_3, ({ struct E_Coll__Option__K__Term* o5 = (struct E_Coll__Option__K__Term*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__Option__K__Term, u) + sizeof(((struct E_Coll__Option__K__Term*)0)->u.C_Coll__Some))); o5->tag = 1; o5->u.C_Coll__Some.f_v = v_want2_4; o5; })); ({ __auto_type v_st1_5 = s5->u.C_Ty__Ex.f_st; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_5; struct E_Coll__List__Ty__Bind* t3 = p_bs; int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = p_acc; p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }); }); }); }); } +static struct E_Ty__Ex* f_Ty__block(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ty__Bind* p_bs, int64_t p_line, struct E_Coll__List__Ast__Stmt* p_ss, struct E_Ast__Expr* p_last, struct E_Coll__Option__K__Term* p_want, struct E_Coll__List__El__Stmt* p_acc) { srs_tail: return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ ({ __auto_type res_ = ({ __auto_type s0 = f_Ty__expr(p_r, p_cx, p_st, p_bs, p_last, p_want); ({ __auto_type v_st1_0 = s0->u.C_Ty__Ex.f_st; __auto_type v_t_1 = s0->u.C_Ty__Ex.f_t; __auto_type v_el_2 = s0->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ struct E_Ty__Ex* o3 = (struct E_Ty__Ex*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Ex, u) + sizeof(((struct E_Ty__Ex*)0)->u.C_Ty__Ex))); o3->tag = 0; o3->u.C_Ty__Ex.f_st = v_st1_0; o3->u.C_Ty__Ex.f_t = v_t_1; o3->u.C_Ty__Ex.f_e = ({ struct E_El__Expr* o3 = (struct E_El__Expr*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Expr, u) + sizeof(((struct E_El__Expr*)0)->u.C_El__Block))); o3->tag = 13; o3->u.C_El__Block.f_line = p_line; o3->u.C_El__Block.f_stmts = f_Coll__rev__El__Stmt(p_r, p_acc); o3->u.C_El__Block.f_last = v_el_2; o3; }); o3; }); res_; }); }); }); res_; }); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Val.f_line; __auto_type v_x_3 = s2->u.C_Ast__Val.f_x; __auto_type v_ann_4 = s2->u.C_Ast__Val.f_ann; __auto_type v_e_5 = s2->u.C_Ast__Val.f_e; f_Ty__bindStmt(p_r, p_cx, p_st, p_bs, p_line, v_sl_2, v_x_3, v_ann_4, v_e_5, false, v_rest_1, p_last, p_want, p_acc); }) : s2->tag == 1 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Var.f_line; __auto_type v_x_3 = s2->u.C_Ast__Var.f_x; __auto_type v_ann_4 = s2->u.C_Ast__Var.f_ann; __auto_type v_e_5 = s2->u.C_Ast__Var.f_e; f_Ty__bindStmt(p_r, p_cx, p_st, p_bs, p_line, v_sl_2, v_x_3, v_ann_4, v_e_5, true, v_rest_1, p_last, p_want, p_acc); }) : s2->tag == 2 ? ({ __auto_type v_sl_2 = s2->u.C_Ast__Handle.f_line; __auto_type v_x_3 = s2->u.C_Ast__Handle.f_x; __auto_type v_h_4 = s2->u.C_Ast__Handle.f_h; __auto_type v_xs_5 = s2->u.C_Ast__Handle.f_args; ({ __auto_type res_ = ({ __auto_type s6 = p_cx; ({ __auto_type v_hs_6 = s6->u.C_Ty__Cx.f_hs; __auto_type v_mode_7 = s6->u.C_Ty__Cx.f_mode; __auto_type v_rows_8 = s6->u.C_Ty__Cx.f_rows; ({ __auto_type res_ = ({ __auto_type s9 = f_Ty__exprs(p_r, p_cx, f_Ty__pureHandle(p_r, v_mode_7, p_st, v_sl_2, v_h_4), p_bs, v_xs_5, (&N_Coll__Nil__El__Expr)); ({ __auto_type v_st1_9 = s9->u.C_Ty__Es.f_st; __auto_type v_eargs_10 = s9->u.C_Ty__Es.f_es; ({ __auto_type res_ = ({ __auto_type s11 = f_Ty__rowCaps(p_r, v_st1_9, p_bs, v_sl_2, f_Eff__row(p_r, v_rows_8, v_h_4), (&N_Coll__Nil__Sym__Sym)); ({ __auto_type v_st2_11 = s11->u.C_Ty__Caps.f_st; __auto_type v_caps_12 = s11->u.C_Ty__Caps.f_caps; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st2_11; struct E_Coll__List__Ty__Bind* t3 = ({ struct E_Coll__List__Ty__Bind* o13 = (struct E_Coll__List__Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Bind, u) + sizeof(((struct E_Coll__List__Ty__Bind*)0)->u.C_Coll__Cons))); o13->tag = 1; o13->u.C_Coll__Cons.f_h = ({ struct E_Ty__Bind* o13 = (struct E_Ty__Bind*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Bind, u) + sizeof(((struct E_Ty__Bind*)0)->u.C_Ty__Bind))); o13->tag = 0; o13->u.C_Ty__Bind.f_x = v_x_3; o13->u.C_Ty__Bind.f_t = ({ struct E_K__Term* o13 = (struct E_K__Term*)srs_alloc(p_r, (int64_t)(offsetof(struct E_K__Term, u) + sizeof(((struct E_K__Term*)0)->u.C_K__Con))); o13->tag = 1; o13->u.C_K__Con.f_f = f_Ty__protoOf(v_hs_6, v_h_4); o13->u.C_K__Con.f_args = (&N_Coll__Nil__K__Term); o13; }); o13; }); o13->u.C_Coll__Cons.f_t = p_bs; o13; }); int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = ({ struct E_Coll__List__El__Stmt* o13 = (struct E_Coll__List__El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Stmt, u) + sizeof(((struct E_Coll__List__El__Stmt*)0)->u.C_Coll__Cons))); o13->tag = 1; o13->u.C_Coll__Cons.f_h = ({ struct E_El__Stmt* o13 = (struct E_El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Stmt, u) + sizeof(((struct E_El__Stmt*)0)->u.C_El__Handle))); o13->tag = 1; o13->u.C_El__Handle.f_line = v_sl_2; o13->u.C_El__Handle.f_x = v_x_3; o13->u.C_El__Handle.f_h = v_h_4; o13->u.C_El__Handle.f_caps = v_caps_12; o13->u.C_El__Handle.f_args = v_eargs_10; o13; }); o13->u.C_Coll__Cons.f_t = p_acc; o13; }); p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_e_2 = s2->u.C_Ast__Do.f_e; ({ __auto_type res_ = ({ __auto_type s3 = f_Ty__expr(p_r, p_cx, p_st, p_bs, v_e_2, (&N_Coll__None__K__Term)); ({ __auto_type v_st1_3 = s3->u.C_Ty__Ex.f_st; __auto_type v_ee_4 = s3->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_3; struct E_Coll__List__Ty__Bind* t3 = p_bs; int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = ({ struct E_Coll__List__El__Stmt* o5 = (struct E_Coll__List__El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Stmt, u) + sizeof(((struct E_Coll__List__El__Stmt*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_El__Stmt* o5 = (struct E_El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Stmt, u) + sizeof(((struct E_El__Stmt*)0)->u.C_El__Do))); o5->tag = 2; o5->u.C_El__Do.f_e = v_ee_4; o5; }); o5->u.C_Coll__Cons.f_t = p_acc; o5; }); p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }) : ({ __auto_type v_k_2 = s2->u.C_Ast__Check.f_k; __auto_type v_e_3 = s2->u.C_Ast__Check.f_e; ({ struct E_K__Term* v_want2_4 = ({ __auto_type s4 = v_k_2; s4->tag == 0 ? ({ f_Ty__con(p_r, ((srs_str){(const uint8_t*)"Bool", 4})); }) : ({ f_Ty__con(p_r, ((srs_str){(const uint8_t*)"I64", 3})); }); }); __auto_type res_ = ({ __auto_type s5 = f_Ty__expr(p_r, p_cx, p_st, p_bs, v_e_3, ({ struct E_Coll__Option__K__Term* o5 = (struct E_Coll__Option__K__Term*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__Option__K__Term, u) + sizeof(((struct E_Coll__Option__K__Term*)0)->u.C_Coll__Some))); o5->tag = 1; o5->u.C_Coll__Some.f_v = v_want2_4; o5; })); ({ __auto_type v_st1_5 = s5->u.C_Ty__Ex.f_st; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_5; struct E_Coll__List__Ty__Bind* t3 = p_bs; int64_t t4 = p_line; struct E_Coll__List__Ast__Stmt* t5 = v_rest_1; struct E_Ast__Expr* t6 = p_last; struct E_Coll__Option__K__Term* t7 = p_want; struct E_Coll__List__El__Stmt* t8 = p_acc; p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_line = t4; p_ss = t5; p_last = t6; p_want = t7; p_acc = t8; goto srs_tail; (struct E_Ty__Ex*){0}; }); res_; }); }); }); res_; }); }); }); }); }); } static struct E_Coll__List__El__Stmt* f_Coll__rev__El__Stmt(srs_cap* p_r, struct E_Coll__List__El__Stmt* p_xs) { return f_Coll__revOnto__El__Stmt(p_r, p_xs, (&N_Coll__Nil__El__Stmt)); } static struct E_Coll__List__El__Stmt* f_Coll__revOnto__El__Stmt(srs_cap* p_r, struct E_Coll__List__El__Stmt* p_xs, struct E_Coll__List__El__Stmt* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__El__Stmt* t1 = v_t_1; struct E_Coll__List__El__Stmt* t2 = ({ struct E_Coll__List__El__Stmt* o2 = (struct E_Coll__List__El__Stmt*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Stmt, u) + sizeof(((struct E_Coll__List__El__Stmt*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_r = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__El__Stmt*){0}; }); }); }); } static struct E_Ty__Es* f_Ty__exprs(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ty__Bind* p_bs, struct E_Coll__List__Ast__Expr* p_xs, struct E_Coll__List__El__Expr* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ ({ struct E_Ty__Es* o0 = (struct E_Ty__Es*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Es, u) + sizeof(((struct E_Ty__Es*)0)->u.C_Ty__Es))); o0->tag = 0; o0->u.C_Ty__Es.f_st = p_st; o0->u.C_Ty__Es.f_es = f_Coll__rev__El__Expr(p_r, p_acc); o0; }); }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = f_Ty__expr(p_r, p_cx, p_st, p_bs, v_x_0, (&N_Coll__None__K__Term)); ({ __auto_type v_st1_2 = s2->u.C_Ty__Ex.f_st; __auto_type v_ex_3 = s2->u.C_Ty__Ex.f_e; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_2; struct E_Coll__List__Ty__Bind* t3 = p_bs; struct E_Coll__List__Ast__Expr* t4 = v_rest_1; struct E_Coll__List__El__Expr* t5 = ({ struct E_Coll__List__El__Expr* o4 = (struct E_Coll__List__El__Expr*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Expr, u) + sizeof(((struct E_Coll__List__El__Expr*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_ex_3; o4->u.C_Coll__Cons.f_t = p_acc; o4; }); p_r = t0; p_cx = t1; p_st = t2; p_bs = t3; p_xs = t4; p_acc = t5; goto srs_tail; (struct E_Ty__Es*){0}; }); res_; }); }); }); res_; }); }); }); } @@ -5002,7 +5019,7 @@ static struct E_Ty__Result* f_Ty__check(srs_cap* p_r, srs_cap* p_eff__Console, s static struct E_Ty__Result* f_Ty__checkWith(srs_cap* p_r, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__Tl__Goal* p_tgs, struct E_Eff__Rows* p_rows) { return ({ __auto_type res_ = ({ __auto_type s0 = f_Ty__cxOf(p_r, p_ds, (&N_Coll__Nil__Ast__Fn), (&N_Coll__Nil__Ast__Enum), (&N_Coll__Nil__Ast__Proto), (&N_Coll__Nil__Ast__Handler), (&N_Coll__Nil__Ast__Trait)); ({ __auto_type v_fns0_0 = s0->u.C_Ty__Cx.f_fns; __auto_type v_es0_1 = s0->u.C_Ty__Cx.f_es; __auto_type v_ps0_2 = s0->u.C_Ty__Cx.f_ps; __auto_type v_hs0_3 = s0->u.C_Ty__Cx.f_hs; __auto_type v_trs0_4 = s0->u.C_Ty__Cx.f_trs; __auto_type v_mode0_5 = s0->u.C_Ty__Cx.f_mode; ({ struct E_Coll__SMap__K__Term* v_nom_6 = f_Ty__nominals(p_r, p_ds, f_Coll__sEmpty__K__Term(p_r)); struct E_Pure__Set* v_pr_7 = (f_Ty__hasSpec(p_ds) ? f_Pure__impure(p_r, p_ds, p_rows) : ({ struct E_Pure__Set* o7 = (struct E_Pure__Set*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Pure__Set, u) + sizeof(((struct E_Pure__Set*)0)->u.C_Pure__Got))); o7->tag = 0; o7->u.C_Pure__Got.f_impure = f_Coll__sEmpty__Bool(p_r); o7; })); struct E_Coll__SMap__Bool* v_imp_8 = ({ __auto_type s8 = v_pr_7; s8->tag == 0 ? ({ __auto_type v_m_8 = s8->u.C_Pure__Got.f_impure; v_m_8; }) : ({ f_Coll__sEmpty__Bool(p_r); }); }); struct E_Ty__St* v_st0_9 = ({ __auto_type s9 = v_pr_7; s9->tag == 0 ? ({ ({ struct E_Ty__St* o9 = (struct E_Ty__St*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__St, u) + sizeof(((struct E_Ty__St*)0)->u.C_Ty__St))); o9->tag = 0; o9->u.C_Ty__St.f_s = (&N_Coll__Tip__K__Term); o9->u.C_Ty__St.f_next = ((int64_t)0); o9->u.C_Ty__St.f_cs = (&N_Coll__Nil__Ty__Clash); o9->u.C_Ty__St.f_is = (&N_Coll__Nil__Ty__Inst); o9->u.C_Ty__St.f_gs = (&N_Coll__Nil__Ty__Goal); o9->u.C_Ty__St.f_nom = v_nom_6; o9; }); }) : ({ __auto_type v_rel_9 = s9->u.C_Pure__RulesBad.f_rel; ({ struct E_Ty__St* o10 = (struct E_Ty__St*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__St, u) + sizeof(((struct E_Ty__St*)0)->u.C_Ty__St))); o10->tag = 0; o10->u.C_Ty__St.f_s = (&N_Coll__Tip__K__Term); o10->u.C_Ty__St.f_next = ((int64_t)0); o10->u.C_Ty__St.f_cs = ({ struct E_Coll__List__Ty__Clash* o10 = (struct E_Coll__List__Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Clash, u) + sizeof(((struct E_Coll__List__Ty__Clash*)0)->u.C_Coll__Cons))); o10->tag = 1; o10->u.C_Coll__Cons.f_h = ({ struct E_Ty__Clash* o10 = (struct E_Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Clash, u) + sizeof(((struct E_Ty__Clash*)0)->u.C_Ty__PureRules))); o10->tag = 9; o10->u.C_Ty__PureRules.f_rel = v_rel_9; o10; }); o10->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Ty__Clash); o10; }); o10->u.C_Ty__St.f_is = (&N_Coll__Nil__Ty__Inst); o10->u.C_Ty__St.f_gs = (&N_Coll__Nil__Ty__Goal); o10->u.C_Ty__St.f_nom = v_nom_6; o10; }); }); }); struct E_Ty__Cx* v_cx_10 = ({ struct E_Ty__Cx* o10 = (struct E_Ty__Cx*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Cx, u) + sizeof(((struct E_Ty__Cx*)0)->u.C_Ty__Cx))); o10->tag = 0; o10->u.C_Ty__Cx.f_fns = v_fns0_0; o10->u.C_Ty__Cx.f_es = v_es0_1; o10->u.C_Ty__Cx.f_ps = v_ps0_2; o10->u.C_Ty__Cx.f_hs = v_hs0_3; o10->u.C_Ty__Cx.f_trs = v_trs0_4; o10->u.C_Ty__Cx.f_mode = v_mode0_5; o10->u.C_Ty__Cx.f_impure = v_imp_8; o10->u.C_Ty__Cx.f_rows = p_rows; o10; }); __auto_type res_ = ({ __auto_type s11 = f_Ty__decls(p_r, v_cx_10, v_st0_9, p_ds, (&N_Coll__Nil__El__Fn), (&N_Coll__Nil__El__Handler), (&N_Coll__Nil__El__Given)); ({ __auto_type v_st1_11 = s11->u.C_Ty__Fns.f_st; __auto_type v_fs_12 = s11->u.C_Ty__Fns.f_fs; __auto_type v_hs_13 = s11->u.C_Ty__Fns.f_hs; __auto_type v_gvs_14 = s11->u.C_Ty__Fns.f_gvs; ({ __auto_type res_ = ({ __auto_type s15 = v_st1_11; ({ __auto_type v_s_15 = s15->u.C_Ty__St.f_s; __auto_type v_cs_16 = s15->u.C_Ty__St.f_cs; __auto_type v_is_17 = s15->u.C_Ty__St.f_is; __auto_type v_gs_18 = s15->u.C_Ty__St.f_gs; ({ struct E_Coll__List__Ty__Goal* v_allGoals_19 = f_Ty__typeGoals(p_r, v_fns0_0, p_tgs, f_Coll__rev__Ty__Goal(p_r, v_gs_18)); struct E_Coll__List__Ty__Clash* v_cs2_20 = f_Ty__externSlots(p_r, v_es0_1, f_Ty__externs(p_r, v_fns0_0, f_Coll__sEmpty__Bool(p_r)), v_s_15, v_is_17, f_Ty__goals(p_r, v_ps0_2, f_Ty__cands(p_r, v_ps0_2, p_ds, (&N_Coll__Nil__Ty__Cand)), v_s_15, v_allGoals_19, v_cs_16)); __auto_type res_ = ({ struct E_Ty__Result* o21 = (struct E_Ty__Result*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Result, u) + sizeof(((struct E_Ty__Result*)0)->u.C_Ty__Result))); o21->tag = 0; o21->u.C_Ty__Result.f_clashes = f_Ty__unsolved(p_r, v_s_15, v_is_17, v_cs2_20); o21->u.C_Ty__Result.f_insts = v_is_17; o21->u.C_Ty__Result.f_s = v_s_15; o21->u.C_Ty__Result.f_fns = v_fs_12; o21->u.C_Ty__Result.f_hs = v_hs_13; o21->u.C_Ty__Result.f_gvs = v_gvs_14; o21; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); } static struct E_Coll__List__Ty__Goal* f_Coll__rev__Ty__Goal(srs_cap* p_r, struct E_Coll__List__Ty__Goal* p_xs) { return f_Coll__revOnto__Ty__Goal(p_r, p_xs, (&N_Coll__Nil__Ty__Goal)); } static struct E_Coll__List__Ty__Goal* f_Coll__revOnto__Ty__Goal(srs_cap* p_r, struct E_Coll__List__Ty__Goal* p_xs, struct E_Coll__List__Ty__Goal* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__Ty__Goal* t1 = v_t_1; struct E_Coll__List__Ty__Goal* t2 = ({ struct E_Coll__List__Ty__Goal* o2 = (struct E_Coll__List__Ty__Goal*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Goal, u) + sizeof(((struct E_Coll__List__Ty__Goal*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_r = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ty__Goal*){0}; }); }); }); } -static struct E_Ty__Fns* f_Ty__decls(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__El__Fn* p_acc, struct E_Coll__List__El__Handler* p_hacc, struct E_Coll__List__El__Given* p_gacc) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ ({ struct E_Ty__Fns* o0 = (struct E_Ty__Fns*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Fns, u) + sizeof(((struct E_Ty__Fns*)0)->u.C_Ty__Fns))); o0->tag = 0; o0->u.C_Ty__Fns.f_st = p_st; o0->u.C_Ty__Fns.f_fs = f_Coll__rev__El__Fn(p_r, p_acc); o0->u.C_Ty__Fns.f_hs = f_Coll__rev__El__Handler(p_r, p_hacc); o0->u.C_Ty__Fns.f_gvs = f_Coll__rev__El__Given(p_r, p_gacc); o0; }); }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = v_f_2; ({ __auto_type v_fname_3 = s3->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ __auto_type s4 = p_cx; ({ __auto_type v_rows_4 = s4->u.C_Ty__Cx.f_rows; ({ __auto_type res_ = ({ __auto_type s5 = f_Ty__fn(p_r, p_cx, p_st, v_f_2, f_Eff__row(p_r, v_rows_4, v_fname_3)); ({ __auto_type v_st1_5 = s5->u.C_Ty__FnEx.f_st; __auto_type v_ef_6 = s5->u.C_Ty__FnEx.f_f; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_5; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = ({ struct E_Coll__List__El__Fn* o7 = (struct E_Coll__List__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Fn, u) + sizeof(((struct E_Coll__List__El__Fn*)0)->u.C_Coll__Cons))); o7->tag = 1; o7->u.C_Coll__Cons.f_h = v_ef_6; o7->u.C_Coll__Cons.f_t = p_acc; o7; }); struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = v_h_2; ({ __auto_type v_hn_3 = s3->u.C_Ast__Handler.f_name; __auto_type v_p_4 = s3->u.C_Ast__Handler.f_proto; __auto_type v_fs_5 = s3->u.C_Ast__Handler.f_fns; ({ __auto_type res_ = ({ __auto_type s6 = f_Ty__fnsEl(p_r, p_cx, p_st, v_fs_5, (&N_Coll__Nil__El__Fn)); ({ __auto_type v_st1_6 = s6->u.C_Ty__Fns.f_st; __auto_type v_efs_7 = s6->u.C_Ty__Fns.f_fs; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_6; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = ({ struct E_Coll__List__El__Handler* o8 = (struct E_Coll__List__El__Handler*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Handler, u) + sizeof(((struct E_Coll__List__El__Handler*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = ({ struct E_El__Handler* o8 = (struct E_El__Handler*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Handler, u) + sizeof(((struct E_El__Handler*)0)->u.C_El__Handler))); o8->tag = 0; o8->u.C_El__Handler.f_name = v_hn_3; o8->u.C_El__Handler.f_proto = v_p_4; o8->u.C_El__Handler.f_fns = v_efs_7; o8; }); o8->u.C_Coll__Cons.f_t = p_hacc; o8; }); struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 5 ? ({ __auto_type v_g_2 = s2->u.C_Ast__DGiven.f_g; ({ __auto_type res_ = ({ __auto_type s3 = v_g_2; ({ __auto_type v_gs_3 = s3->u.C_Ast__Given.f_groups; __auto_type v_head_4 = s3->u.C_Ast__Given.f_head; __auto_type v_fs_5 = s3->u.C_Ast__Given.f_fns; ({ __auto_type res_ = ({ __auto_type s6 = f_Ty__fnsEl(p_r, p_cx, f_Ty__givenShape(p_r, p_cx, p_st, v_g_2), f_Ty__underGroups(p_r, v_gs_3, v_fs_5, (&N_Coll__Nil__Ast__Fn)), (&N_Coll__Nil__El__Fn)); ({ __auto_type v_st1_6 = s6->u.C_Ty__Fns.f_st; __auto_type v_efs_7 = s6->u.C_Ty__Fns.f_fs; ({ struct E_El__Given* v_gv_8 = ({ struct E_El__Given* o8 = (struct E_El__Given*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Given, u) + sizeof(((struct E_El__Given*)0)->u.C_El__Given))); o8->tag = 0; o8->u.C_El__Given.f_tparams = f_Ty__tparams(p_r, v_gs_3, (&N_Coll__Nil__Sym__Sym)); o8->u.C_El__Given.f_ev = f_Ty__binderNames(p_r, f_Ty__evidence(p_r, v_gs_3, (&N_Coll__Nil__Ast__Binder)), (&N_Coll__Nil__Sym__Sym)); o8->u.C_El__Given.f_head = f_Ty__term(p_r, v_head_4, (&N_Coll__Nil__Ty__Bind)); o8->u.C_El__Given.f_fns = v_efs_7; o8; }); __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_6; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = ({ struct E_Coll__List__El__Given* o9 = (struct E_Coll__List__El__Given*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Given, u) + sizeof(((struct E_Coll__List__El__Given*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = v_gv_8; o9->u.C_Coll__Cons.f_t = p_gacc; o9; }); p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = p_st; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); }); }); }); }); } +static struct E_Ty__Fns* f_Ty__decls(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Decl* p_ds, struct E_Coll__List__El__Fn* p_acc, struct E_Coll__List__El__Handler* p_hacc, struct E_Coll__List__El__Given* p_gacc) { srs_tail: return ({ __auto_type s0 = p_ds; s0->tag == 0 ? ({ ({ struct E_Ty__Fns* o0 = (struct E_Ty__Fns*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Fns, u) + sizeof(((struct E_Ty__Fns*)0)->u.C_Ty__Fns))); o0->tag = 0; o0->u.C_Ty__Fns.f_st = p_st; o0->u.C_Ty__Fns.f_fs = f_Coll__rev__El__Fn(p_r, p_acc); o0->u.C_Ty__Fns.f_hs = f_Coll__rev__El__Handler(p_r, p_hacc); o0->u.C_Ty__Fns.f_gvs = f_Coll__rev__El__Given(p_r, p_gacc); o0; }); }) : ({ __auto_type v_d_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type s2 = v_d_0; s2->tag == 0 ? ({ __auto_type v_f_2 = s2->u.C_Ast__DFn.f_f; ({ __auto_type res_ = ({ __auto_type s3 = v_f_2; ({ __auto_type v_fname_3 = s3->u.C_Ast__Fn.f_name; ({ __auto_type res_ = ({ __auto_type s4 = p_cx; ({ __auto_type v_rows_4 = s4->u.C_Ty__Cx.f_rows; ({ __auto_type res_ = ({ __auto_type s5 = f_Ty__fn(p_r, p_cx, p_st, v_f_2, f_Eff__row(p_r, v_rows_4, v_fname_3)); ({ __auto_type v_st1_5 = s5->u.C_Ty__FnEx.f_st; __auto_type v_ef_6 = s5->u.C_Ty__FnEx.f_f; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_5; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = ({ struct E_Coll__List__El__Fn* o7 = (struct E_Coll__List__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Fn, u) + sizeof(((struct E_Coll__List__El__Fn*)0)->u.C_Coll__Cons))); o7->tag = 1; o7->u.C_Coll__Cons.f_h = v_ef_6; o7->u.C_Coll__Cons.f_t = p_acc; o7; }); struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 3 ? ({ __auto_type v_h_2 = s2->u.C_Ast__DHandler.f_h; ({ __auto_type res_ = ({ __auto_type s3 = v_h_2; ({ __auto_type v_hn_3 = s3->u.C_Ast__Handler.f_name; __auto_type v_p_4 = s3->u.C_Ast__Handler.f_proto; __auto_type v_fs_5 = s3->u.C_Ast__Handler.f_fns; ({ __auto_type res_ = ({ __auto_type s6 = p_cx; ({ __auto_type v_rows_6 = s6->u.C_Ty__Cx.f_rows; ({ __auto_type res_ = ({ __auto_type s7 = f_Ty__fnsEl(p_r, p_cx, p_st, v_fs_5, f_Eff__row(p_r, v_rows_6, v_hn_3), (&N_Coll__Nil__El__Fn)); ({ __auto_type v_st1_7 = s7->u.C_Ty__Fns.f_st; __auto_type v_efs_8 = s7->u.C_Ty__Fns.f_fs; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_7; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = ({ struct E_Coll__List__El__Handler* o9 = (struct E_Coll__List__El__Handler*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Handler, u) + sizeof(((struct E_Coll__List__El__Handler*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = ({ struct E_El__Handler* o9 = (struct E_El__Handler*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Handler, u) + sizeof(((struct E_El__Handler*)0)->u.C_El__Handler))); o9->tag = 0; o9->u.C_El__Handler.f_name = v_hn_3; o9->u.C_El__Handler.f_proto = v_p_4; o9->u.C_El__Handler.f_fns = v_efs_8; o9; }); o9->u.C_Coll__Cons.f_t = p_hacc; o9; }); struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }); }); res_; }); }) : s2->tag == 5 ? ({ __auto_type v_g_2 = s2->u.C_Ast__DGiven.f_g; ({ __auto_type res_ = ({ __auto_type s3 = v_g_2; ({ __auto_type v_gs_3 = s3->u.C_Ast__Given.f_groups; __auto_type v_head_4 = s3->u.C_Ast__Given.f_head; __auto_type v_fs_5 = s3->u.C_Ast__Given.f_fns; ({ __auto_type res_ = ({ __auto_type s6 = f_Ty__fnsEl(p_r, p_cx, f_Ty__givenShape(p_r, p_cx, p_st, v_g_2), f_Ty__underGroups(p_r, v_gs_3, v_fs_5, (&N_Coll__Nil__Ast__Fn)), (&N_Coll__Nil__Eff__Cap), (&N_Coll__Nil__El__Fn)); ({ __auto_type v_st1_6 = s6->u.C_Ty__Fns.f_st; __auto_type v_efs_7 = s6->u.C_Ty__Fns.f_fs; ({ struct E_El__Given* v_gv_8 = ({ struct E_El__Given* o8 = (struct E_El__Given*)srs_alloc(p_r, (int64_t)(offsetof(struct E_El__Given, u) + sizeof(((struct E_El__Given*)0)->u.C_El__Given))); o8->tag = 0; o8->u.C_El__Given.f_tparams = f_Ty__tparams(p_r, v_gs_3, (&N_Coll__Nil__Sym__Sym)); o8->u.C_El__Given.f_ev = f_Ty__binderNames(p_r, f_Ty__evidence(p_r, v_gs_3, (&N_Coll__Nil__Ast__Binder)), (&N_Coll__Nil__Sym__Sym)); o8->u.C_El__Given.f_head = f_Ty__term(p_r, v_head_4, (&N_Coll__Nil__Ty__Bind)); o8->u.C_El__Given.f_fns = v_efs_7; o8; }); __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_6; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = ({ struct E_Coll__List__El__Given* o9 = (struct E_Coll__List__El__Given*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Given, u) + sizeof(((struct E_Coll__List__El__Given*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = v_gv_8; o9->u.C_Coll__Cons.f_t = p_gacc; o9; }); p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); res_; }); }) : ({ ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = p_st; struct E_Coll__List__Ast__Decl* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = p_acc; struct E_Coll__List__El__Handler* t5 = p_hacc; struct E_Coll__List__El__Given* t6 = p_gacc; p_r = t0; p_cx = t1; p_st = t2; p_ds = t3; p_acc = t4; p_hacc = t5; p_gacc = t6; goto srs_tail; (struct E_Ty__Fns*){0}; }); }); }); }); }); } static struct E_Coll__List__El__Fn* f_Coll__rev__El__Fn(srs_cap* p_r, struct E_Coll__List__El__Fn* p_xs) { return f_Coll__revOnto__El__Fn(p_r, p_xs, (&N_Coll__Nil__El__Fn)); } static struct E_Coll__List__El__Fn* f_Coll__revOnto__El__Fn(srs_cap* p_r, struct E_Coll__List__El__Fn* p_xs, struct E_Coll__List__El__Fn* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__El__Fn* t1 = v_t_1; struct E_Coll__List__El__Fn* t2 = ({ struct E_Coll__List__El__Fn* o2 = (struct E_Coll__List__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Fn, u) + sizeof(((struct E_Coll__List__El__Fn*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_r = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__El__Fn*){0}; }); }); }); } static struct E_Coll__List__El__Handler* f_Coll__rev__El__Handler(srs_cap* p_r, struct E_Coll__List__El__Handler* p_xs) { return f_Coll__revOnto__El__Handler(p_r, p_xs, (&N_Coll__Nil__El__Handler)); } @@ -5011,7 +5028,7 @@ static struct E_Coll__List__El__Given* f_Coll__rev__El__Given(srs_cap* p_r, stru static struct E_Coll__List__El__Given* f_Coll__revOnto__El__Given(srs_cap* p_r, struct E_Coll__List__El__Given* p_xs, struct E_Coll__List__El__Given* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_r; struct E_Coll__List__El__Given* t1 = v_t_1; struct E_Coll__List__El__Given* t2 = ({ struct E_Coll__List__El__Given* o2 = (struct E_Coll__List__El__Given*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Given, u) + sizeof(((struct E_Coll__List__El__Given*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_r = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__El__Given*){0}; }); }); }); } static struct E_Coll__List__Ast__Fn* f_Ty__underGroups(srs_cap* p_r, struct E_Coll__List__Ast__Group* p_gs, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__Ast__Fn* p_acc) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ f_Coll__rev__Ast__Fn(p_r, p_acc); }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_f_0; ({ __auto_type v_line_2 = s2->u.C_Ast__Fn.f_line; __auto_type v_name_3 = s2->u.C_Ast__Fn.f_name; __auto_type v_fgs_4 = s2->u.C_Ast__Fn.f_groups; __auto_type v_ps_5 = s2->u.C_Ast__Fn.f_params; __auto_type v_ret_6 = s2->u.C_Ast__Fn.f_ret; __auto_type v_exit_7 = s2->u.C_Ast__Fn.f_exit; __auto_type v_body_8 = s2->u.C_Ast__Fn.f_body; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Group* t1 = p_gs; struct E_Coll__List__Ast__Fn* t2 = v_rest_1; struct E_Coll__List__Ast__Fn* t3 = ({ struct E_Coll__List__Ast__Fn* o9 = (struct E_Coll__List__Ast__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ast__Fn, u) + sizeof(((struct E_Coll__List__Ast__Fn*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = ({ struct E_Ast__Fn* o9 = (struct E_Ast__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ast__Fn, u) + sizeof(((struct E_Ast__Fn*)0)->u.C_Ast__Fn))); o9->tag = 0; o9->u.C_Ast__Fn.f_line = v_line_2; o9->u.C_Ast__Fn.f_name = v_name_3; o9->u.C_Ast__Fn.f_groups = f_Coll__revOnto__Ast__Group(p_r, f_Coll__rev__Ast__Group(p_r, p_gs), v_fgs_4); o9->u.C_Ast__Fn.f_params = v_ps_5; o9->u.C_Ast__Fn.f_ret = v_ret_6; o9->u.C_Ast__Fn.f_exit = v_exit_7; o9->u.C_Ast__Fn.f_body = v_body_8; o9; }); o9->u.C_Coll__Cons.f_t = p_acc; o9; }); p_r = t0; p_gs = t1; p_fs = t2; p_acc = t3; goto srs_tail; (struct E_Coll__List__Ast__Fn*){0}; }); res_; }); }); }); res_; }); }); }); } static struct E_Coll__List__Sym__Sym* f_Ty__binderNames(srs_cap* p_r, struct E_Coll__List__Ast__Binder* p_bs, struct E_Coll__List__Sym__Sym* p_acc) { srs_tail: return ({ __auto_type s0 = p_bs; s0->tag == 0 ? ({ f_Coll__rev__Sym__Sym(p_r, p_acc); }) : ({ __auto_type v_b_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_b_0; ({ __auto_type v_x_2 = s2->u.C_Ast__Binder.f_x; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Coll__List__Ast__Binder* t1 = v_rest_1; struct E_Coll__List__Sym__Sym* t2 = ({ struct E_Coll__List__Sym__Sym* o3 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = v_x_2; o3->u.C_Coll__Cons.f_t = p_acc; o3; }); p_r = t0; p_bs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Sym__Sym*){0}; }); res_; }); }); }); res_; }); }); }); } -static struct E_Ty__Fns* f_Ty__fnsEl(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__El__Fn* p_acc) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ ({ struct E_Ty__Fns* o0 = (struct E_Ty__Fns*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Fns, u) + sizeof(((struct E_Ty__Fns*)0)->u.C_Ty__Fns))); o0->tag = 0; o0->u.C_Ty__Fns.f_st = p_st; o0->u.C_Ty__Fns.f_fs = f_Coll__rev__El__Fn(p_r, p_acc); o0->u.C_Ty__Fns.f_hs = (&N_Coll__Nil__El__Handler); o0->u.C_Ty__Fns.f_gvs = (&N_Coll__Nil__El__Given); o0; }); }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = f_Ty__fn(p_r, p_cx, p_st, v_f_0, (&N_Coll__Nil__Eff__Cap)); ({ __auto_type v_st1_2 = s2->u.C_Ty__FnEx.f_st; __auto_type v_ef_3 = s2->u.C_Ty__FnEx.f_f; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_2; struct E_Coll__List__Ast__Fn* t3 = v_rest_1; struct E_Coll__List__El__Fn* t4 = ({ struct E_Coll__List__El__Fn* o4 = (struct E_Coll__List__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Fn, u) + sizeof(((struct E_Coll__List__El__Fn*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_ef_3; o4->u.C_Coll__Cons.f_t = p_acc; o4; }); p_r = t0; p_cx = t1; p_st = t2; p_fs = t3; p_acc = t4; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); } +static struct E_Ty__Fns* f_Ty__fnsEl(srs_cap* p_r, struct E_Ty__Cx* p_cx, struct E_Ty__St* p_st, struct E_Coll__List__Ast__Fn* p_fs, struct E_Coll__List__Eff__Cap* p_row, struct E_Coll__List__El__Fn* p_acc) { srs_tail: return ({ __auto_type s0 = p_fs; s0->tag == 0 ? ({ ({ struct E_Ty__Fns* o0 = (struct E_Ty__Fns*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Fns, u) + sizeof(((struct E_Ty__Fns*)0)->u.C_Ty__Fns))); o0->tag = 0; o0->u.C_Ty__Fns.f_st = p_st; o0->u.C_Ty__Fns.f_fs = f_Coll__rev__El__Fn(p_r, p_acc); o0->u.C_Ty__Fns.f_hs = (&N_Coll__Nil__El__Handler); o0->u.C_Ty__Fns.f_gvs = (&N_Coll__Nil__El__Given); o0; }); }) : ({ __auto_type v_f_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = f_Ty__fn(p_r, p_cx, p_st, v_f_0, p_row); ({ __auto_type v_st1_2 = s2->u.C_Ty__FnEx.f_st; __auto_type v_ef_3 = s2->u.C_Ty__FnEx.f_f; ({ __auto_type res_ = ({ srs_cap* t0 = p_r; struct E_Ty__Cx* t1 = p_cx; struct E_Ty__St* t2 = v_st1_2; struct E_Coll__List__Ast__Fn* t3 = v_rest_1; struct E_Coll__List__Eff__Cap* t4 = p_row; struct E_Coll__List__El__Fn* t5 = ({ struct E_Coll__List__El__Fn* o4 = (struct E_Coll__List__El__Fn*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__El__Fn, u) + sizeof(((struct E_Coll__List__El__Fn*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = v_ef_3; o4->u.C_Coll__Cons.f_t = p_acc; o4; }); p_r = t0; p_cx = t1; p_st = t2; p_fs = t3; p_row = t4; p_acc = t5; goto srs_tail; (struct E_Ty__Fns*){0}; }); res_; }); }); }); res_; }); }); }); } static struct E_Coll__List__Ty__Clash* f_Ty__unsolved(srs_cap* p_r, struct E_Coll__IMap__K__Term* p_s, struct E_Coll__List__Ty__Inst* p_is, struct E_Coll__List__Ty__Clash* p_cs) { srs_tail: return ({ __auto_type s0 = p_is; s0->tag == 0 ? ({ p_cs; }) : ({ __auto_type v_i_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_i_0; ({ __auto_type v_line_2 = s2->u.C_Ty__Inst.f_line; __auto_type v_f_3 = s2->u.C_Ty__Inst.f_f; __auto_type v_ts_4 = s2->u.C_Ty__Inst.f_targs; ({ __auto_type res_ = (f_Ty__ground(p_r, p_s, v_ts_4) ? ({ srs_cap* t0 = p_r; struct E_Coll__IMap__K__Term* t1 = p_s; struct E_Coll__List__Ty__Inst* t2 = v_rest_1; struct E_Coll__List__Ty__Clash* t3 = p_cs; p_r = t0; p_s = t1; p_is = t2; p_cs = t3; goto srs_tail; (struct E_Coll__List__Ty__Clash*){0}; }) : ({ srs_cap* t0 = p_r; struct E_Coll__IMap__K__Term* t1 = p_s; struct E_Coll__List__Ty__Inst* t2 = v_rest_1; struct E_Coll__List__Ty__Clash* t3 = ({ struct E_Coll__List__Ty__Clash* o5 = (struct E_Coll__List__Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Coll__List__Ty__Clash, u) + sizeof(((struct E_Coll__List__Ty__Clash*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_Ty__Clash* o5 = (struct E_Ty__Clash*)srs_alloc(p_r, (int64_t)(offsetof(struct E_Ty__Clash, u) + sizeof(((struct E_Ty__Clash*)0)->u.C_Ty__CannotInfer))); o5->tag = 5; o5->u.C_Ty__CannotInfer.f_line = v_line_2; o5->u.C_Ty__CannotInfer.f_name = v_f_3; o5; }); o5->u.C_Coll__Cons.f_t = p_cs; o5; }); p_r = t0; p_s = t1; p_is = t2; p_cs = t3; goto srs_tail; (struct E_Coll__List__Ty__Clash*){0}; })); res_; }); }); }); res_; }); }); }); } static bool f_Ty__ground(srs_cap* p_r, struct E_Coll__IMap__K__Term* p_s, struct E_Coll__List__K__Term* p_ts) { srs_tail: return ({ __auto_type s0 = p_ts; s0->tag == 0 ? ({ true; }) : ({ __auto_type v_t_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; (f_Ty__groundT(f_K__reify(p_r, p_s, v_t_0)) ? ({ srs_cap* t0 = p_r; struct E_Coll__IMap__K__Term* t1 = p_s; struct E_Coll__List__K__Term* t2 = v_rest_1; p_r = t0; p_s = t1; p_ts = t2; goto srs_tail; (bool){0}; }) : false); }); }); } static bool f_Ty__groundT(struct E_K__Term* p_t) { return ({ __auto_type s0 = p_t; s0->tag == 0 ? ({ false; }) : s0->tag == 2 ? ({ true; }) : ({ __auto_type v_args_0 = s0->u.C_K__Con.f_args; f_Ty__groundAll(v_args_0); }); }); } diff --git a/s2/eff.srs b/s2/eff.srs index 9fc753a3..72c55710 100644 --- a/s2/eff.srs +++ b/s2/eff.srs @@ -5,6 +5,8 @@ // row(F, P) :- needs(F, P), not decl(F, P) // req(F, P) is written only when no handle of P is in scope; scope 0 handles nothing. each row(F, P) is one implicit // {eff.P: P} binder of F (Ty.fn); main has none, so a request main does not handle is error[unhandled-effect]. +// a handler H is one subject F (E1b): its fns' bodies are its facts, and `handle x = H()` is calls(F, H, S) in the scope +// outside the handle, so the handlers outside it answer what its ops request (deep handlers, kyo semantics). enum Eff.Rel: case Eff.RReq @@ -153,7 +155,7 @@ def Eff.cxOf {r: Region} (ds: Coll.List[Ast.Decl], cx: Eff.Cx): Eff.Cx = ds matc case Ast.DProto(p) => Eff.cxOf(rest, Eff.Cx(Coll.Cons(p, ps), hp, fns, ctors, ss)) case Ast.DHandler(h) => val Ast.Handler(_, n, p, _) = h - Eff.cxOf(rest, Eff.Cx(ps, Coll.sInsert(hp, n, p), fns, ctors, ss)) + Eff.cxOf(rest, Eff.Cx(ps, Coll.sInsert(hp, n, p), Coll.sInsert(fns, n, Eff.Runs), ctors, ss)) case Ast.DFn(f) => val Ast.Fn(_, n, _, _, _, _, _) = f Eff.cxOf(rest, Eff.Cx(ps, hp, Coll.sInsert(fns, n, Eff.calleeOf(f)), ctors, ss)) @@ -205,18 +207,29 @@ def Eff.decls {r: Region} (cx: Eff.Cx, ds: Coll.List[Ast.Decl], w: Eff.W): Coll. case Coll.Cons(d, rest) => d match case Ast.DFn(f) => val Eff.W(n, fs, _, _) = w - Eff.decls(cx, rest, Eff.fn(cx, f, Eff.W(n, fs, Coll.Nil, Coll.sEmpty()))) + val Ast.Fn(_, fname, _, _, _, _, _) = f + Eff.decls(cx, rest, Eff.fn(cx, fname, f, Eff.W(n, fs, Coll.Nil, Coll.sEmpty()))) + // a handler is one subject: its row is what all its fns need (E1b), kept at its handle site + case Ast.DHandler(h) => + val Eff.W(n, fs, _, _) = w + val Ast.Handler(_, hn, _, hfs) = h + Eff.decls(cx, rest, Eff.hfns(cx, hn, hfs, Eff.W(n, fs, Coll.Nil, Coll.sEmpty()))) case _ => Eff.decls(cx, rest, w) // decl(F, P) for each {} binder of a protocol; the body of a run def (a spec def is pure: it has no row) -def Eff.fn {r: Region} (cx: Eff.Cx, f: Ast.Fn, w: Eff.W): Eff.W = - val Ast.Fn(_, n, gs, ps, _, _, body) = f +// n: the subject, the def itself or its handler +def Eff.fn {r: Region} (cx: Eff.Cx, n: Sym.Sym, f: Ast.Fn, w: Eff.W): Eff.W = + val Ast.Fn(_, _, gs, ps, _, _, body) = f val ev = Ty.evidence(gs, Coll.Nil) val w1 = Eff.declsOf(cx, n, ev, w) body match case Ast.Def(_, e) => Eff.expr(cx, Eff.At(n, 0, Coll.Nil, Ty.names(ps, Ty.names(ev, Coll.Nil))), e, w1) case _ => w1 +def Eff.hfns {r: Region} (cx: Eff.Cx, h: Sym.Sym, fs: Coll.List[Ast.Fn], w: Eff.W): Eff.W = fs match + case Coll.Nil => w + case Coll.Cons(f, rest) => Eff.hfns(cx, h, rest, Eff.fn(cx, h, f, w)) + def Eff.declsOf {r: Region} (cx: Eff.Cx, f: Sym.Sym, bs: Coll.List[Ast.Binder], w: Eff.W): Eff.W = bs match case Coll.Nil => w case Coll.Cons(b, rest) => @@ -312,8 +325,9 @@ def Eff.stmts {r: Region} (cx: Eff.Cx, at: Eff.At, ss: Coll.List[Ast.Stmt], last case Coll.Cons(s, rest) => s match case Ast.Val(_, x, _, e) => Eff.stmts(cx, Eff.local(at, Coll.Cons(x, Coll.Nil)), rest, last, Eff.expr(cx, at, e, w)) case Ast.Var(_, x, _, e) => Eff.stmts(cx, Eff.local(at, Coll.Cons(x, Coll.Nil)), rest, last, Eff.expr(cx, at, e, w)) + // the handler's row is needed here, in the scope outside its own handle (deep handlers, E1b) case Ast.Handle(_, x, h, xs) => - val Eff.W(n, fs, rq, cs) = Eff.exprs(cx, at, xs, w) + val Eff.W(n, fs, rq, cs) = Eff.call(cx, at, h, Eff.exprs(cx, at, xs, w)) val Eff.Cx(_, hp, _, _, ss) = cx val Eff.Syms(_, _, _, hdRel, _) = ss val Eff.At(f, _, hd, ls) = at diff --git a/s2/elab.srs b/s2/elab.srs index 05cc450c..7f0a7e88 100644 --- a/s2/elab.srs +++ b/s2/elab.srs @@ -32,7 +32,8 @@ enum El.Arm: enum El.Stmt: // a val or var with its type (emit declares the C local with it) case El.Val(line: I64, x: Sym.Sym, ty: K.Term, mut: Bool, e: El.Expr) - case El.Handle(line: I64, x: Sym.Sym, h: Sym.Sym, args: Coll.List[El.Expr]) + // caps: the handler's row (s2/eff.srs), the capabilities of the handle site it keeps for its ops (E1b) + case El.Handle(line: I64, x: Sym.Sym, h: Sym.Sym, caps: Coll.List[Sym.Sym], args: Coll.List[El.Expr]) case El.Do(e: El.Expr) // a def: its [] binders (instantiated by mono), its protocol {} binders (leading C params), params with types diff --git a/s2/emit.srs b/s2/emit.srs index fd4fabc4..6a6d4b14 100644 --- a/s2/emit.srs +++ b/s2/emit.srs @@ -364,6 +364,29 @@ def Emit.capArgs(env: Emit.Env, caps: Coll.List[Sym.Sym], s: Emit.Sep): Unit = c Emit.local(Emit.vs(env), c) Emit.capArgs(env, rest, Emit.Comma) +// h_H_init(caps, args): the handler's state +def Emit.initCall {r: Region} (cx: Emit.Cx, fi: Emit.Fi, env: Emit.Env, h: Sym.Sym, caps: Coll.List[Sym.Sym], args: Coll.List[El.Expr]): Unit = + Console.print("h_") + Emit.id(h) + Console.print("_init(") + Emit.capArgs(env, caps, Emit.First) + Emit.args(cx, fi, env, args, if Coll.length(caps) == 0 then Emit.First else Emit.Comma) + Console.print(")") + +// a handler with a row (E1b): its state and the capabilities of the handle site, the self of its ops (srs_env) +def Emit.handleEnv {r: Region} (cx: Emit.Cx, fi: Emit.Fi, env: Emit.Env, v: Emit.Name, h: Sym.Sym, caps: Coll.List[Sym.Sym], args: Coll.List[El.Expr]): Unit = caps match + case Coll.Nil => () + case Coll.Cons(_, _) => + Console.print("struct { void* st; srs_cap* c[") + Console.printI64(Coll.length(caps)) + Console.print("]; } ") + Emit.cname(v) + Console.print("_e = { ") + Emit.initCall(cx, fi, env, h, caps, args) + Console.print(", { ") + Emit.capArgs(env, caps, Emit.First) + Console.print(" } }; ") + def Emit.args {r: Region} (cx: Emit.Cx, fi: Emit.Fi, env: Emit.Env, xs: Coll.List[El.Expr], s: Emit.Sep): Unit = xs match case Coll.Nil => () case Coll.Cons(x, rest) => @@ -631,15 +654,19 @@ def Emit.block {r: Region} (cx: Emit.Cx, fi: Emit.Fi, env: Emit.Env, pos: Emit.P Emit.ex(cx, fi, env, Emit.Inner, e) Console.print("; ") Emit.block(cx, fi, Emit.bind(env, x), pos, rest, last, drops) - case El.Handle(_, x, h, args) => + case El.Handle(_, x, h, caps, args) => val v = Emit.L(x, Emit.envN(env)) + Emit.handleEnv(cx, fi, env, v, h, caps, args) Console.print("srs_cap ") Emit.cname(v) - Console.print("_v = { h_") - Emit.id(h) - Console.print("_init(") - Emit.args(cx, fi, env, args, Emit.First) - Console.print("), vt_") + Console.print("_v = { ") + caps match + case Coll.Nil => Emit.initCall(cx, fi, env, h, caps, args) + case Coll.Cons(_, _) => + Console.print("&") + Emit.cname(v) + Console.print("_e") + Console.print(", vt_") Emit.id(h) Console.print(", 1 }; srs_cap* ") Emit.cname(v) @@ -705,7 +732,7 @@ def Emit.armsTail {r: Region} (cx: Emit.Cx, fi: Emit.Fi, as: Coll.List[El.Arm]): def Emit.hasHandle(ss: Coll.List[El.Stmt]): Bool = ss match case Coll.Nil => false case Coll.Cons(s, rest) => s match - case El.Handle(_, _, _, _) => true + case El.Handle(_, _, _, _, _) => true case _ => Emit.hasHandle(rest) // ── an instance as the fn emit prints ── @@ -840,7 +867,7 @@ def Emit.stmtsTys {r: Region} (cx: Emit.Cx, fi: Emit.Fi, ss: Coll.List[El.Stmt], case Coll.Nil => acc case Coll.Cons(s, rest) => s match case El.Val(_, _, ty, _, e) => Emit.stmtsTys(cx, fi, rest, Emit.exTys(cx, fi, e, Coll.Cons(Emit.gr(cx, fi, ty), acc))) - case El.Handle(_, _, _, args) => Emit.stmtsTys(cx, fi, rest, Emit.exsTys(cx, fi, args, acc)) + case El.Handle(_, _, _, _, args) => Emit.stmtsTys(cx, fi, rest, Emit.exsTys(cx, fi, args, acc)) case El.Do(e) => Emit.stmtsTys(cx, fi, rest, Emit.exTys(cx, fi, e, acc)) // the distinct enum terms of todo and of their fields, in the order found (seen: by hash bucket) @@ -1039,29 +1066,88 @@ def Emit.implFns {r: Region} (cx: Emit.Cx, k: Emit.Kind, fs: Coll.List[El.Fn], w def Emit.vtables {r: Region} (cx: Emit.Cx, hs: Coll.List[El.Handler]): Unit = hs match case Coll.Nil => () case Coll.Cons(h, rest) => - val El.Handler(hn, p, _) = h + val El.Handler(hn, p, fs) = h val Emit.Cx(_, _, _, _, ps, _, _, _) = cx + val pre: Str = if Emit.hasRow(fs) then "w_" else "h_" + Emit.wrappers(cx, hn, fs) Console.print("static void* const vt_") Emit.id(hn) Console.print("[] = {") Coll.sLookup(ps, p) match case Coll.Some(pr) => val Ast.Proto(_, _, _, _, _, _, ops, _) = pr - Emit.vtOps(hn, ops) + Emit.vtOps(pre, hn, ops) case Coll.None => () Console.print(" 0 };\n") Emit.vtables(cx, rest) -def Emit.vtOps(hn: Sym.Sym, ops: Coll.List[Ast.Op]): Unit = ops match +// a handler with a row (E1b): every fn takes the same implicit capabilities +def Emit.hasRow(fs: Coll.List[El.Fn]): Bool = fs match + case Coll.Nil => false + case Coll.Cons(f, _) => + val El.Fn(_, _, _, caps, _, _, _) = f + Coll.length(caps) > 0 + +// its vtable entries: w_H_op(srs_env* e, args) calls h_H_op(e->c[0], .., e->st, args) (init is not in the vtable) +def Emit.wrappers {r: Region} (cx: Emit.Cx, hn: Sym.Sym, fs: Coll.List[El.Fn]): Unit = fs match + case Coll.Nil => () + case Coll.Cons(f, rest) => + val El.Fn(_, name, _, caps, _, _, _) = f + if Coll.length(caps) > 0 && !Str.eq(Sym.str(name), "init") then + val Emit.Fi(_, _, _, slots, ret) = Emit.fiOf(cx, Mono.Inst(f, Coll.Nil, Mono.Top)) + Console.print("static ") + Emit.ctype(cx, ret) + Console.print(" w_") + Emit.id(hn) + Console.print("_") + Emit.id(name) + Console.print("(void* e_") + Emit.params(cx, Emit.opSlots(slots), Emit.Comma) + Console.print(") { srs_env* e = (srs_env*)e_; return h_") + Emit.id(hn) + Console.print("_") + Emit.id(name) + Console.print("(") + Emit.envCaps(0, Coll.length(caps)) + Console.print("e->st") + Emit.slotArgs(Emit.opSlots(slots)) + Console.print("); }\n") + else () + Emit.wrappers(cx, hn, rest) + +// the op's own params: no capability, no self +def Emit.opSlots(slots: Coll.List[Emit.Slot]): Coll.List[Emit.Slot] = slots match + case Coll.Nil => Coll.Nil + case Coll.Cons(s, rest) => s match + case Emit.SCap(_) => Emit.opSlots(rest) + case Emit.SVal(_, _) => rest + +def Emit.envCaps(i: I64, n: I64): Unit = + if i < n then + Console.print("e->c[") + Console.printI64(i) + Console.print("], ") + Emit.envCaps(i + 1, n) + else () + +def Emit.slotArgs(slots: Coll.List[Emit.Slot]): Unit = slots match + case Coll.Nil => () + case Coll.Cons(s, rest) => + Console.print(", p_") + Emit.id(Emit.slotName(s)) + Emit.slotArgs(rest) + +def Emit.vtOps(pre: Str, hn: Sym.Sym, ops: Coll.List[Ast.Op]): Unit = ops match case Coll.Nil => () case Coll.Cons(o, rest) => val Ast.Op(_, n, _, _, _) = o - Console.print(" (void*)h_") + Console.print(" (void*)") + Console.print(pre) Emit.id(hn) Console.print("_") Emit.id(n) Console.print(",") - Emit.vtOps(hn, rest) + Emit.vtOps(pre, hn, rest) // the inline Arena bump (spec sec 5.2): the chunk layout of rt/srs_rt.c:24-25 def Emit.allocFast {r: Region} (cx: Emit.Cx): Unit = @@ -1094,6 +1180,7 @@ def Emit.program {r: Region} (ds: Coll.List[Ast.Decl], res: Ty.Result): Unit = Console.print("#include \n#include \n#include \n") Console.print("typedef struct { const uint8_t* p; int64_t n; } srs_str;\n") Console.print("typedef struct { void* self; void* const* vt; int64_t live; } srs_cap;\n") + Console.print("typedef struct { void* st; srs_cap* c[]; } srs_env;\n") Console.print("void rt_init(int argc, char** argv);\n") Emit.fwds(ens) Emit.structs(cx, ens) diff --git a/s2/mono.srs b/s2/mono.srs index 0b6f955e..a3f8be2c 100644 --- a/s2/mono.srs +++ b/s2/mono.srs @@ -228,5 +228,5 @@ def Mono.stmtCalls {r: Region} (s: Coll.IMap[K.Term], sub: Coll.List[Ty.Bind], x val acc2 = x match case El.Val(_, _, _, _, e) => Mono.calls(s, sub, e, acc) case El.Do(e) => Mono.calls(s, sub, e, acc) - case El.Handle(_, _, _, args) => Mono.callsAll(s, sub, args, acc) + case El.Handle(_, _, _, _, args) => Mono.callsAll(s, sub, args, acc) Mono.stmtCalls(s, sub, rest, acc2) diff --git a/s2/pure.srs b/s2/pure.srs index 5ed1517d..22e13a96 100644 --- a/s2/pure.srs +++ b/s2/pure.srs @@ -114,23 +114,23 @@ def Pure.hprotos {r: Region} (ds: Coll.List[Ast.Decl], m: Coll.SMap[Sym.Sym]): C Pure.hprotos(rest, Coll.sInsert(m, n, p)) case _ => Pure.hprotos(rest, m) -// a def's inferred row (s2/eff.srs) uses each of its protocols, as a written {} binder does +// a def's or a handler's inferred row (s2/eff.srs) uses each of its protocols, as a written {} binder does def Pure.decls {r: Region} (ps: Coll.List[Sym.Sym], hp: Coll.SMap[Sym.Sym], rows: Eff.Rows, ds: Coll.List[Ast.Decl], acc: Coll.List[D.Fact]): Coll.List[D.Fact] = ds match case Coll.Nil => acc case Coll.Cons(d, rest) => d match case Ast.DFn(f) => val Ast.Fn(_, n, _, _, _, _, _) = f - Pure.decls(ps, hp, rows, rest, Pure.rowUses(n, Eff.row(rows, n), Pure.fn(ps, hp, Pure.Def(n), f, acc))) + Pure.decls(ps, hp, rows, rest, Pure.rowUses(Pure.Def(n), Eff.row(rows, n), Pure.fn(ps, hp, Pure.Def(n), f, acc))) case Ast.DHandler(h) => val Ast.Handler(_, n, p, fs) = h - Pure.decls(ps, hp, rows, rest, Pure.fns(ps, hp, Pure.In(n), fs, Coll.Cons(Pure.f2(Pure.RHandles, n, p), acc))) + Pure.decls(ps, hp, rows, rest, Pure.rowUses(Pure.In(n), Eff.row(rows, n), Pure.fns(ps, hp, Pure.In(n), fs, Coll.Cons(Pure.f2(Pure.RHandles, n, p), acc)))) case _ => Pure.decls(ps, hp, rows, rest, acc) -def Pure.rowUses {r: Region} (f: Sym.Sym, cs: Coll.List[Eff.Cap], acc: Coll.List[D.Fact]): Coll.List[D.Fact] = cs match +def Pure.rowUses {r: Region} (w: Pure.Who, cs: Coll.List[Eff.Cap], acc: Coll.List[D.Fact]): Coll.List[D.Fact] = cs match case Coll.Nil => acc case Coll.Cons(c, rest) => val Eff.Cap(p, _) = c - Pure.rowUses(f, rest, Coll.Cons(Pure.f2(Pure.RUses, f, p), acc)) + Pure.rowUses(w, rest, Coll.Cons(Pure.f2(Pure.uses(w), Pure.subj(w), p), acc)) def Pure.fns {r: Region} (ps: Coll.List[Sym.Sym], hp: Coll.SMap[Sym.Sym], w: Pure.Who, fs: Coll.List[Ast.Fn], acc: Coll.List[D.Fact]): Coll.List[D.Fact] = fs match case Coll.Nil => acc diff --git a/s2/types.srs b/s2/types.srs index 7e9e6f65..56fc89e1 100644 --- a/s2/types.srs +++ b/s2/types.srs @@ -553,10 +553,12 @@ def Ty.block {r: Region} (cx: Ty.Cx, st: Ty.St, bs: Coll.List[Ty.Bind], line: I6 case Coll.Cons(s, rest) => s match case Ast.Val(sl, x, ann, e) => Ty.bindStmt(cx, st, bs, line, sl, x, ann, e, false, rest, last, want, acc) case Ast.Var(sl, x, ann, e) => Ty.bindStmt(cx, st, bs, line, sl, x, ann, e, true, rest, last, want, acc) + // the handler's row takes the innermost capabilities outside this handle (E1b) case Ast.Handle(sl, x, h, xs) => - val Ty.Cx(_, _, _, hs, _, mode, _, _) = cx + val Ty.Cx(_, _, _, hs, _, mode, _, rows) = cx val Ty.Es(st1, eargs) = Ty.exprs(cx, Ty.pureHandle(mode, st, sl, h), bs, xs, Coll.Nil) - Ty.block(cx, st1, Coll.Cons(Ty.Bind(x, K.Con(Ty.protoOf(hs, h), Coll.Nil)), bs), line, rest, last, want, Coll.Cons(El.Handle(sl, x, h, eargs), acc)) + val Ty.Caps(st2, caps) = Ty.rowCaps(st1, bs, sl, Eff.row(rows, h), Coll.Nil) + Ty.block(cx, st2, Coll.Cons(Ty.Bind(x, K.Con(Ty.protoOf(hs, h), Coll.Nil)), bs), line, rest, last, want, Coll.Cons(El.Handle(sl, x, h, caps, eargs), acc)) case Ast.Do(e) => val Ty.Ex(st1, _, ee) = Ty.expr(cx, st, bs, e, Coll.None) Ty.block(cx, st1, bs, line, rest, last, want, Coll.Cons(El.Do(ee), acc)) @@ -705,14 +707,16 @@ def Ty.decls {r: Region} (cx: Ty.Cx, st: Ty.St, ds: Coll.List[Ast.Decl], acc: Co val Ty.Cx(_, _, _, _, _, _, _, rows) = cx val Ty.FnEx(st1, ef) = Ty.fn(cx, st, f, Eff.row(rows, fname)) Ty.decls(cx, st1, rest, Coll.Cons(ef, acc), hacc, gacc) + // every fn of a handler takes the handler's row (E1b): the capabilities its handle site keeps case Ast.DHandler(h) => val Ast.Handler(_, hn, p, fs) = h - val Ty.Fns(st1, efs, _, _) = Ty.fnsEl(cx, st, fs, Coll.Nil) + val Ty.Cx(_, _, _, _, _, _, _, rows) = cx + val Ty.Fns(st1, efs, _, _) = Ty.fnsEl(cx, st, fs, Eff.row(rows, hn), Coll.Nil) Ty.decls(cx, st1, rest, acc, Coll.Cons(El.Handler(hn, p, efs), hacc), gacc) // a given's fns see its binders: its [] binders are theirs, its {} evidence is local case Ast.DGiven(g) => val Ast.Given(_, gs, head, fs) = g - val Ty.Fns(st1, efs, _, _) = Ty.fnsEl(cx, Ty.givenShape(cx, st, g), Ty.underGroups(gs, fs, Coll.Nil), Coll.Nil) + val Ty.Fns(st1, efs, _, _) = Ty.fnsEl(cx, Ty.givenShape(cx, st, g), Ty.underGroups(gs, fs, Coll.Nil), Coll.Nil, Coll.Nil) val gv = El.Given(Ty.tparams(gs, Coll.Nil), Ty.binderNames(Ty.evidence(gs, Coll.Nil), Coll.Nil), Ty.term(head, Coll.Nil), efs) Ty.decls(cx, st1, rest, acc, hacc, Coll.Cons(gv, gacc)) case _ => Ty.decls(cx, st, rest, acc, hacc, gacc) @@ -729,12 +733,12 @@ def Ty.binderNames {r: Region} (bs: Coll.List[Ast.Binder], acc: Coll.List[Sym.Sy val Ast.Binder(_, x, _) = b Ty.binderNames(rest, Coll.Cons(x, acc)) -// fns of a handler or given, elaborated in order -def Ty.fnsEl {r: Region} (cx: Ty.Cx, st: Ty.St, fs: Coll.List[Ast.Fn], acc: Coll.List[El.Fn]): Ty.Fns = fs match +// fns of a handler or given, elaborated in order, each with row +def Ty.fnsEl {r: Region} (cx: Ty.Cx, st: Ty.St, fs: Coll.List[Ast.Fn], row: Coll.List[Eff.Cap], acc: Coll.List[El.Fn]): Ty.Fns = fs match case Coll.Nil => Ty.Fns(st, Coll.rev(acc), Coll.Nil, Coll.Nil) case Coll.Cons(f, rest) => - val Ty.FnEx(st1, ef) = Ty.fn(cx, st, f, Coll.Nil) - Ty.fnsEl(cx, st1, rest, Coll.Cons(ef, acc)) + val Ty.FnEx(st1, ef) = Ty.fn(cx, st, f, row) + Ty.fnsEl(cx, st1, rest, row, Coll.Cons(ef, acc)) // an instance with a type arg that is still a var after the whole program: CannotInfer def Ty.unsolved {r: Region} (s: Coll.IMap[K.Term], is: Coll.List[Ty.Inst], cs: Coll.List[Ty.Clash]): Coll.List[Ty.Clash] = is match diff --git a/tests/s2/neg/eff_handler_row.srs b/tests/s2/neg/eff_handler_row.srs new file mode 100644 index 00000000..a3eaf5d1 --- /dev/null +++ b/tests/s2/neg/eff_handler_row.srs @@ -0,0 +1,16 @@ +// expect: error[unhandled-effect] +// a handler whose ops request Console needs a Console handler outside its handle +protocol Out: + state Live + start Live + end Live + op put(n: I64): Unit : Live -> Live + +handler Std for Out: + def put(n: I64): Unit = Console.printI64(n) + +def main(): I64 = + handle s = Std() + Out.put(1) + 0 +// expect: --> tests/s2/neg/eff_handler_row.srs:13 diff --git a/tests/s2/prog/eff_handler_row.out b/tests/s2/prog/eff_handler_row.out new file mode 100644 index 00000000..48b4d842 --- /dev/null +++ b/tests/s2/prog/eff_handler_row.out @@ -0,0 +1,3 @@ +1 +20 +3 diff --git a/tests/s2/prog/eff_handler_row.srs b/tests/s2/prog/eff_handler_row.srs new file mode 100644 index 00000000..1d355cb8 --- /dev/null +++ b/tests/s2/prog/eff_handler_row.srs @@ -0,0 +1,29 @@ +// pass: E1b (vic 2026-11-09: kyo semantics, deep handlers): a handler op body may request effects; the handlers outside +// its handle answer them, captured when the handle runs. Tag requests Out inside its own put: Std answers, not Tag. +// viaStd opens Std itself: its row gets Console from Std's row +protocol Out: + state Live + start Live + end Live + op put(n: I64): Unit : Live -> Live + +handler Std for Out: + def put(n: I64): Unit = + Console.printI64(n) + Console.print("\n") + +handler Tag for Out: + def put(n: I64): Unit = Out.put(n * 10) + +def viaStd(n: I64): Unit = + handle s = Std() + Out.put(n) + +def main(): I64 = + handle c = Srs.Console() + handle s = Std() + Out.put(1) + handle t = Tag() + Out.put(2) + viaStd(3) + 0 diff --git a/tests/s2/types.srs b/tests/s2/types.srs index 83c9a791..bf6f324e 100644 --- a/tests/s2/types.srs +++ b/tests/s2/types.srs @@ -205,7 +205,7 @@ def TT.stmts {r: Region} (s: Coll.IMap[K.Term], ss: Coll.List[El.Stmt]): Unit = x match case El.Val(_, _, _, _, e) => TT.calls(s, e) case El.Do(e) => TT.calls(s, e) - case El.Handle(_, _, _, _) => () + case El.Handle(_, _, _, _, _) => () TT.stmts(s, rest) def TT.elab {r: Region} (src: Str, lib: Coll.List[Ast.Decl], name: Str): Unit = @@ -263,7 +263,7 @@ def TT.badsStmts(xs: Coll.List[El.Stmt]): I64 = xs match val k = s match case El.Val(_, _, _, _, e) => TT.bads(e) case El.Do(e) => TT.bads(e) - case El.Handle(_, _, _, args) => TT.badsAll(args) + case El.Handle(_, _, _, _, args) => TT.badsAll(args) k + TT.badsStmts(rest) // ── B1 mono: the instances (callee [args]) in worklist order; ground = no var in any instance's args ──