Add implicit tagbody to dolist
This commit is contained in:
parent
97d472bf6a
commit
e2df0bcefe
2 changed files with 15 additions and 2 deletions
|
@ -1172,7 +1172,7 @@ sub macro_dolist {
|
||||||
|
|
||||||
slurp_token($ts, RPAREN, "Expected ) after list-form or result-form in 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(
|
return create_block(
|
||||||
"nil",
|
"nil",
|
||||||
|
|
15
t/dolist.t
15
t/dolist.t
|
@ -1,4 +1,4 @@
|
||||||
(plan 5)
|
(plan 6)
|
||||||
|
|
||||||
(expect "dolist - body is evaluated with every element"
|
(expect "dolist - body is evaluated with every element"
|
||||||
(let ((lst (list 1 2 5 'cool 'list 'bro nil))
|
(let ((lst (list 1 2 5 'cool 'list 'bro nil))
|
||||||
|
@ -29,3 +29,16 @@
|
||||||
(unless (null e)
|
(unless (null e)
|
||||||
(throw 'test 'fail))))
|
(throw 'test 'fail))))
|
||||||
'ok)))
|
'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)))
|
||||||
|
|
Loading…
Reference in a new issue