summaryrefslogtreecommitdiff
path: root/pez.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-05-06 16:39:57 +0200
committerlemon <lsof@mailbox.org>2025-05-06 16:39:57 +0200
commit4c422d4ff80de1f5cd055c5f793dd936593ffbca (patch)
treef1e6b6ddff27fd30a8c097b8d3ab9a83a21d1b39 /pez.c
parenta74d1a93205f540806596aeb0eb7cfa8d3ee2dc1 (diff)
fix
Diffstat (limited to 'pez.c')
-rw-r--r--pez.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pez.c b/pez.c
index 30735a2..1f50cab 100644
--- a/pez.c
+++ b/pez.c
@@ -529,7 +529,7 @@ delproto(PezContext *cx, Proto *pr)
}
}
-static inline void FORCEINLINE
+static inline void
closeups(PezContext *cx, Val *ptr)
{
for (Upval *up = cx->openup, *prev = NULL, *next; up; up = next) {
@@ -2299,14 +2299,14 @@ static const PezUserType file_ctype = {
static bool
f_ioopen(PezContext *cx, int argc)
{
- char buf[9];
+ char buf1[9], buf2[9];
FILE *f;
const char *mode = "r";
TRY(pez_checksig(cx, argc, "io#open", "string, ?string"));
if (argc == 2) {
- mode = pez_getstring(cx, buf, -1);
+ mode = pez_getstring(cx, buf1, -1);
}
- f = fopen(pez_getstring(cx, buf, -argc), mode);
+ f = fopen(pez_getstring(cx, buf2, -argc), mode);
return f ? pez_pushuserobj(cx, &file_ctype, &f) : pez_pushvoid(cx);
}
@@ -4100,7 +4100,11 @@ stmt(Comp *cm)
TRY(expectspchr(cm, '='));
TRY(box_str(cm->cx, &key, name, strlen(name)));
TRY(compconst(cm, key));
- TRY(expr(cm)); // initializer
+ if (matchspchr(cm, '{')) {
+ TRY(lambdaexpr(cm, name)); // named fn
+ } else {
+ TRY(expr(cm)); // initializer
+ }
TRY(compop(cm, Odupbck));
TRY(compop(cm, Oputglo));
} else if ((c = peekchr(cm)) == 'F' || c == 'R' || c == 'B') {