aqua/aqua-src/restrict.aqua
2021-11-17 08:25:06 +03:00

54 lines
1001 B
Plaintext

module Restrict
export withLoop, buildOptUsage, checkKeepReturn, checkKeepArg, retrieve_records
func withLoop(xs: []string):
for x <- xs:
s: *string
s <<- x
func buildOpt() -> ?string:
s: *string
s <<- "none"
<- s
func buildOptUsage():
a <- buildOpt()
b <- buildOpt()
for x <- b:
z <- buildOpt()
func keepReturn() -> *string:
s: *string
s <<- "should be not restricted"
<- s
func checkKeepReturn() -> []string:
s <- keepReturn()
s <<- "and more"
<- s
func keepArg(arg: *string) -> []string:
arg <<- "push more"
<- arg
func checkKeepArg() -> []string, []string:
a: *string
keepArg(a)
y <- keepArg(a)
a <<- "more"
<- a, y
-- failing Aqua code:
service TestService("test-service"):
get_records(key: string) -> []string
func append_records(peer: string, srum: *[]string):
srum <- TestService.get_records(peer)
func retrieve_records(peer: string) -> [][]string:
records: *[]string
append_records(peer, records)
<- records