From d5f4e2b6bb474ab97548db6590a3a58c59e96753 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Sat, 10 Apr 2021 22:38:54 +0200 Subject: [PATCH] Add implict tagbody to dolist --- lib/Minilisp.pm | 2 +- t/dotimes.t | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) 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)))