aqua/aqua-src/restrict.aqua

54 lines
1001 B
Plaintext
Raw Permalink Normal View History

2021-11-17 05:25:06 +00:00
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