summaryrefslogtreecommitdiff
path: root/pez.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-10-09 21:20:32 +0200
committerlemon <lsof@mailbox.org>2022-10-09 21:20:52 +0200
commitf5fa6cde9e1d8157df86b34129c9e844d329329a (patch)
treef30dc9ba261123124de2e13e19ab9aa9c22fde50 /pez.c
parentfe9e41c9b2f541124e9ed5b193b3eeb2f696fa50 (diff)
RET statement
Diffstat (limited to 'pez.c')
-rw-r--r--pez.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pez.c b/pez.c
index a6a7c92..1ad9670 100644
--- a/pez.c
+++ b/pez.c
@@ -1354,7 +1354,7 @@ exefn(PezContext *cx, Fn *fn, uint nargs)
CASE(Onop) {}
CASE(Oret) {
Val ret = pop(cx);
- cx->stktop -= pr->nvars;
+ cx->stktop = locals;
assert(cx->stktop >= cx->stack);
push(cx, ret);
closeups(cx, args);
@@ -3513,6 +3513,8 @@ stmt(Comp *cm)
TRY(readident(cm, buf, sizeof buf));
if (!strcmp(buf, "FOR")) {
return forstmt(cm);
+ } else if (!strcmp(buf, "RET")) {
+ return expr(cm) && compop(cm, Oret);
} else {
strcpy(cm->stash_ident, buf);
return expr(cm);