mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
54 lines
1001 B
Plaintext
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
|