Files
mgmt/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar
2023-06-01 16:56:44 -04:00

44 lines
1.5 KiB
Plaintext

-- main.mcl --
import "fmt"
# note that the class can have two separate types for $b
include c1("t1", "hello") # len is 5
include c1("t2", [13, 42, 0, -37,]) # len is 4
class c1($a, $b) {
test $a {
anotherstr => fmt.printf("len is: %d", len($b)),
}
}
-- OUTPUT --
Edge: call:len(var(b)) -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a
Edge: call:len(var(b)) -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a
Edge: int(-37) -> list(int(13), int(42), int(0), int(-37)) # 3
Edge: int(0) -> list(int(13), int(42), int(0), int(-37)) # 2
Edge: int(13) -> list(int(13), int(42), int(0), int(-37)) # 0
Edge: int(42) -> list(int(13), int(42), int(0), int(-37)) # 1
Edge: list(int(13), int(42), int(0), int(-37)) -> var(b) # var:b
Edge: str("hello") -> var(b) # var:b
Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # format
Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # format
Edge: str("t1") -> var(a) # var:a
Edge: str("t2") -> var(a) # var:a
Edge: var(b) -> call:len(var(b)) # 0
Edge: var(b) -> call:len(var(b)) # 0
Vertex: call:fmt.printf(str("len is: %d"), call:len(var(b)))
Vertex: call:fmt.printf(str("len is: %d"), call:len(var(b)))
Vertex: call:len(var(b))
Vertex: call:len(var(b))
Vertex: int(-37)
Vertex: int(0)
Vertex: int(13)
Vertex: int(42)
Vertex: list(int(13), int(42), int(0), int(-37))
Vertex: str("hello")
Vertex: str("len is: %d")
Vertex: str("t1")
Vertex: str("t2")
Vertex: var(a)
Vertex: var(a)
Vertex: var(b)
Vertex: var(b)