mirror of
https://github.com/ilyakooo0/luau.git
synced 2024-10-05 14:47:22 +03:00
Returns
This commit is contained in:
parent
9054a6736b
commit
996ab8bc20
@ -532,17 +532,51 @@
|
||||
==
|
||||
:: Blok
|
||||
::
|
||||
+$ blok (lest stat)
|
||||
+$ blok [body=(lest stat) ret=(unit ret)]
|
||||
++ print-blok
|
||||
|= [=blok]
|
||||
^- tape
|
||||
%- zing
|
||||
%+ join "\0a"
|
||||
(turn blok print-stat)
|
||||
%+ weld
|
||||
(turn body.blok print-stat)
|
||||
?~ ret.blok ~
|
||||
~[(print-ret u.ret.blok)]
|
||||
++ parse-blok
|
||||
%+ knee *blok
|
||||
|.
|
||||
;~ plug
|
||||
(most wss parse-stat)
|
||||
::
|
||||
%- punt
|
||||
;~ pfix
|
||||
wss
|
||||
parse-ret
|
||||
==
|
||||
==
|
||||
:: ret
|
||||
::
|
||||
+$ ret exprlist
|
||||
++ print-ret
|
||||
|= =ret
|
||||
^- tape
|
||||
%- zing
|
||||
:~
|
||||
"return "
|
||||
(print-exprlist ret)
|
||||
==
|
||||
++ parse-ret
|
||||
%+ knee *ret
|
||||
|.
|
||||
%+ cook
|
||||
|= [[* =exprlist] *] exprlist
|
||||
;~ plug
|
||||
;~ (glue wss)
|
||||
(jest 'return')
|
||||
parse-exprlist
|
||||
==
|
||||
(punt (just ';'))
|
||||
==
|
||||
:: Helpers
|
||||
::
|
||||
++ commaed
|
||||
|
@ -44,3 +44,8 @@ foo = {
|
||||
3.0, 3.1416, 314.16e-2, 0.31416E1, 34e1,
|
||||
0x0.1E, 0xA23p-4, 0xA23p-4, 0X1.921FB54442D18P+1, 0x1.fp10
|
||||
}
|
||||
|
||||
do
|
||||
foo = 1
|
||||
return 8, foo;
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user