diff options
| author | 2022-10-09 21:20:32 +0200 | |
|---|---|---|
| committer | 2022-10-09 21:20:52 +0200 | |
| commit | f5fa6cde9e1d8157df86b34129c9e844d329329a (patch) | |
| tree | f30dc9ba261123124de2e13e19ab9aa9c22fde50 | |
| parent | fe9e41c9b2f541124e9ed5b193b3eeb2f696fa50 (diff) | |
RET statement
| -rw-r--r-- | pez.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |