Returns
commit996ab8bc2039c3bb1c3caa8686d47cf00fc1f28c
authoriko <mail@iko.soy>
dateFri 17 May 2024, 23:30 (2 years ago)
parent9054a67
zod/luau/lib/lua.hoon+37−3
@@ -532,17 +532,51 @@
532532 ==
533533:: Blok
534534::
535−+$ blok (lest stat)
535++$ blok [body=(lest stat) ret=(unit ret)]
536536++ print-blok
537537 |= [=blok]
538538 ^- tape
539539 %- zing
540540 %+ join "\0a"
541− (turn blok print-stat)
541+ %+ weld
542+ (turn body.blok print-stat)
543+ ?~ ret.blok ~
544+ ~[(print-ret u.ret.blok)]
542545++ parse-blok
543546 %+ knee *blok
544547 |.
545− (most wss parse-stat)
548+ ;~ plug
549+ (most wss parse-stat)
550+ ::
551+ %- punt
552+ ;~ pfix
553+ wss
554+ parse-ret
555+ ==
556+ ==
557+:: ret
558+::
559++$ ret exprlist
560+++ print-ret
561+ |= =ret
562+ ^- tape
563+ %- zing
564+ :~
565+ "return "
566+ (print-exprlist ret)
567+ ==
568+++ parse-ret
569+ %+ knee *ret
570+ |.
571+ %+ cook
572+ |= [[* =exprlist] *] exprlist
573+ ;~ plug
574+ ;~ (glue wss)
575+ (jest 'return')
576+ parse-exprlist
577+ ==
578+ (punt (just ';'))
579+ ==
546580:: Helpers
547581::
548582++ commaed
zod/luau/tests/foo.lua+5
@@ -44,3 +44,8 @@ foo = {
4444 3.0, 3.1416, 314.16e-2, 0.31416E1, 34e1,
4545 0x0.1E, 0xA23p-4, 0xA23p-4, 0X1.921FB54442D18P+1, 0x1.fp10
4646}
47+
48+do
49+ foo = 1
50+ return 8, foo;
51+end