Add implicit tagbody to the do macro

This commit is contained in:
madmaurice 2021-04-10 22:14:02 +02:00
parent e6342eda24
commit 19de2ff4e8
2 changed files with 16 additions and 2 deletions

View file

@ -960,7 +960,7 @@ sub macro_do {
slurp_token($ts, RPAREN, "Expected ) after resultform");
my $body = macro_progn($ts);
my $body = macro_tagbody($ts);
return create_block("nil", sub {
my $octx = shift;

16
t/do.t
View file

@ -1,4 +1,6 @@
(plan 3)
(plan 4)
(defun nop () nil)
(expect "do - simple example"
(equal (do ((n 1)) (t n)) 1))
@ -20,3 +22,15 @@
(do () (t)
(return 'fail))
'ok)))
(expect "do - implicit tagbody"
(equal 'ok
(catch 'test
(do ((n 0 (+ 1 n))) ((> n 0))
(nop)
(nop)
(go end)
middle
(throw 'test 'fail)
end)
'ok)))