From fd92b1f891167e110cfd2d7ec85b5c53d5c586c1 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 10 Oct 2022 11:21:21 +0200 Subject: bug fixes --- pez.c | 15 +++++++++++---- pez.h | 1 + test.pez | 1 - 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pez.c b/pez.c index 84d24c9..bc68b38 100644 --- a/pez.c +++ b/pez.c @@ -475,14 +475,21 @@ delproto(PezContext *cx, Proto *pr) } static void -closeups(PezContext *cx, Val *vals) +closeups(PezContext *cx, Val *ptr) { - for (Upval *up = cx->openup, *next; up; up = next) { + for (Upval *up = cx->openup, *prev = NULL, *next; up; up = next) { next = up->nextup; - if (up->ptr >= vals) { - cx->openup = next; + if (up->ptr >= ptr) { + if (prev) { + prev->nextup = next; + } + if (up == cx->openup) { + cx->openup = next; + } up->slot = *up->ptr; up->ptr = &up->slot; + } else { + prev = up; } } } diff --git a/pez.h b/pez.h index 4edc0df..e802d26 100644 --- a/pez.h +++ b/pez.h @@ -20,6 +20,7 @@ enum { PEZ_TTuple, PEZ_TRecord, PEZ_TArray, + PEZ_TDilambda }; typedef enum PezError { diff --git a/test.pez b/test.pez index d01ea10..eb98d75 100644 --- a/test.pez +++ b/test.pez @@ -7,7 +7,6 @@ @Array2d: {[w, h] @data: array#fill[w * h, 0] - @w = w dilambda[ {[x, y] data[x + (y * w)] }, {[x, y, new] data[x + (y * w)] = new } -- cgit v1.2.3