lang: Port TestAstFunc1 to txtar format
This commit is contained in:
29
lang/interpret_test/TestAstFunc1/simple-lambda2.txtar
Normal file
29
lang/interpret_test/TestAstFunc1/simple-lambda2.txtar
Normal file
@@ -0,0 +1,29 @@
|
||||
-- main.mcl --
|
||||
import "fmt"
|
||||
|
||||
# this should be a function as a value, iow a lambda
|
||||
$answer = func() {
|
||||
"the answer is 42"
|
||||
}
|
||||
|
||||
$out1 = $answer()
|
||||
$out2 = $answer()
|
||||
|
||||
test $out1 + $out2 {}
|
||||
-- OUTPUT --
|
||||
Edge: call:answer() -> var(out1) # var:out1
|
||||
Edge: call:answer() -> var(out2) # var:out2
|
||||
Edge: func() { str("the answer is 42") } -> call:answer() # call:answer
|
||||
Edge: func() { str("the answer is 42") } -> call:answer() # call:answer
|
||||
Edge: str("+") -> call:_operator(str("+"), var(out1), var(out2)) # op
|
||||
Edge: str("the answer is 42") -> func() { str("the answer is 42") } # body
|
||||
Edge: var(out1) -> call:_operator(str("+"), var(out1), var(out2)) # a
|
||||
Edge: var(out2) -> call:_operator(str("+"), var(out1), var(out2)) # b
|
||||
Vertex: call:_operator(str("+"), var(out1), var(out2))
|
||||
Vertex: call:answer()
|
||||
Vertex: call:answer()
|
||||
Vertex: func() { str("the answer is 42") }
|
||||
Vertex: str("+")
|
||||
Vertex: str("the answer is 42")
|
||||
Vertex: var(out1)
|
||||
Vertex: var(out2)
|
||||
Reference in New Issue
Block a user