diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index 46d03ce..bfe3204 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -1134,7 +1134,7 @@ sub macro_dotimes { slurp_token($ts, RPAREN, "Expected ) after count-form or result-form in dotimes"); - my $body = macro_progn($ts); + my $body = macro_tagbody($ts); return create_block( "nil", diff --git a/t/dotimes.t b/t/dotimes.t index e6ebce2..133493e 100644 --- a/t/dotimes.t +++ b/t/dotimes.t @@ -1,4 +1,4 @@ -(plan 5) +(plan 6) (expect "dotimes - executes body n times" (let ((pings 0)) @@ -28,3 +28,16 @@ (dotimes (i -3) (throw 'test 'fail)) 'ok))) + +(defun nop () nil) + +(expect "dotimes - implicit tagbody" + (equal 'ok + (catch 'test + (dotimes (e 1) + nil + (go end) + middle + (throw 'test 'fail) + end) + 'ok)))