Add implicit block to do macro

This commit is contained in:
madmaurice 2021-04-08 21:53:21 +02:00
parent e6cb6bd047
commit 46d904535a
2 changed files with 9 additions and 2 deletions

View file

@ -920,7 +920,7 @@ sub macro_do {
my $body = macro_progn($ts);
return sub {
return create_block("nil", sub {
my $octx = shift;
my $ictx = ctx_create($octx);
@ -946,7 +946,7 @@ sub macro_do {
}
return $result_form->($ictx);
}
});
}
$macros{do} = \&macro_do;

7
t/do.t
View file

@ -11,3 +11,10 @@
(comment lst)
lst)
(list 1 2 3)))
(expect "do - has implicit block nil"
(equal 'ok
(block nil
(do () (t)
(return 'fail))
'ok)))