mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
12ee2d52fa
* CallArrowToken in the parser * CallArrowRawTag * unfoldArrow * handle IntoIndexRaw for CallArrowRaw * Removed useless CallArrowRawTag.service argument * RawValueInliner split into several classes * cliJS compiles * Parser tests compile * Semantics spec compile but fail * Allow braces around values * infix token WIP * InfixToken WIP * Fixes #423 * Infix (arithmetic) operations order * Infix (arithmetic) operations parallelism fix * seq it! * fix inline test * fix transform test * fix semantics spec * fix CallArrowSem * bugfix * Fix for CLI help typo * merge * Order fix * Order fix * optional space after `func` in closures * some doc comments Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
70 lines
1.5 KiB
Plaintext
70 lines
1.5 KiB
Plaintext
module Closure declares *
|
|
|
|
import "builtin.aqua"
|
|
|
|
export closureOut2, closureIn, closureOut, closureBig, closureOut3
|
|
|
|
service MyOp("op"):
|
|
identity(s: string) -> string
|
|
|
|
service LocalSrv("local_srv"):
|
|
inside: -> ()
|
|
withNums: i64 -> i64
|
|
|
|
func closureOut2():
|
|
on HOST_PEER_ID:
|
|
closure = () -> Info:
|
|
p2Id <- Peer.identify()
|
|
<- p2Id
|
|
closure()
|
|
|
|
func closureIn(peer1: string) -> string:
|
|
variable = "const"
|
|
co on peer1:
|
|
p1Id <- MyOp.identity("co on")
|
|
closure = (s: string) -> string:
|
|
if s == "in":
|
|
LocalSrv.inside()
|
|
p2Id <- MyOp.identity(s)
|
|
<- p2Id
|
|
p <- closure("in")
|
|
<- p
|
|
|
|
func closureOut3(peer2: string) -> Info:
|
|
on peer2:
|
|
closure = (s: string) -> Info:
|
|
if s == "in":
|
|
LocalSrv.inside()
|
|
p2Id <- Peer.identify()
|
|
<- p2Id
|
|
p2Id <- closure( ( closureIn("on") ) )
|
|
<- p2Id
|
|
|
|
func closureOut(peer2: string) -> Info:
|
|
closure = func (s: string) -> Info:
|
|
if s == "in":
|
|
LocalSrv.inside()
|
|
p2Id <- Peer.identify()
|
|
<- p2Id
|
|
on peer2:
|
|
p2Id <- closure("on")
|
|
LocalSrv.withNums(3+5 * 2)
|
|
<- p2Id
|
|
|
|
func closureBig(peer1: string, peer2: string) -> string, string:
|
|
variable = "const"
|
|
co on peer1:
|
|
p1Id <- MyOp.identity("co on")
|
|
closure = func (s: string) -> string:
|
|
p2Id: *string
|
|
if s == "in":
|
|
p2 <- MyOp.identity(s)
|
|
p2Id <<- p2
|
|
else:
|
|
p2Info <- Peer.identify()
|
|
p2Id <<- p2Info.external_addresses!0
|
|
<- p2Id!
|
|
p <- closure("in")
|
|
on peer2:
|
|
p2Id <- closure("on")
|
|
<- p, p2Id |