Add implicit tagbody to dolist

This commit is contained in:
madmaurice 2021-04-10 22:36:18 +02:00
parent 97d472bf6a
commit e2df0bcefe
2 changed files with 15 additions and 2 deletions

View file

@ -1172,7 +1172,7 @@ sub macro_dolist {
slurp_token($ts, RPAREN, "Expected ) after list-form or result-form in dolist");
my $body = macro_progn($ts);
my $body = macro_tagbody($ts);
return create_block(
"nil",

View file

@ -1,4 +1,4 @@
(plan 5)
(plan 6)
(expect "dolist - body is evaluated with every element"
(let ((lst (list 1 2 5 'cool 'list 'bro nil))
@ -29,3 +29,16 @@
(unless (null e)
(throw 'test 'fail))))
'ok)))
(defun nop () nil)
(expect "dolist - implicit tagbody"
(equal 'ok
(catch 'test
(dolist (e (list 1) 'ok)
nil
(go end)
middle
(throw 'test 'fail)
end)
'ok)))