From 9c2cf3e8ae31de4aa519aff876563172aefcd99c Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 11 Nov 2022 21:21:26 +0100 Subject: esc: when called without arguments, return void --- mew.scm | 9 ++++++--- tests/test.mew | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mew.scm b/mew.scm index 92197b3..10a1f41 100644 --- a/mew.scm +++ b/mew.scm @@ -191,9 +191,12 @@ (define-syntax esc (syntax-rules () ((_ return body ...) - (call-with-current-continuation - (lambda (return) - (seq body ...)))))) + (receive vals (call-with-current-continuation + (lambda (return) + (seq body ...))) + (if (null? vals) + (void) + (car vals)))))) (define-syntax fin (syntax-rules () diff --git a/tests/test.mew b/tests/test.mew index 904127d..3af29c0 100644 --- a/tests/test.mew +++ b/tests/test.mew @@ -147,6 +147,7 @@ (test-group "esc" (test #t (void? (esc ret))) + (test #t (void? (esc ret (ret)))) (test 42 (esc ret (* 6 7))) (test 42 (esc ret -- cgit 1.4.1