68 lines
1.6 KiB
Plaintext
68 lines
1.6 KiB
Plaintext
-- main.mcl --
|
|
import "fmt"
|
|
|
|
# this value should only be built once
|
|
$some_value1 = 42 # or something more complex like the output of a slow function...
|
|
class foo($num) {
|
|
# we should have a different `$inside` value for each use of this class
|
|
$inside = $some_value1 + $some_value2 + 4
|
|
test [fmt.printf("test-%d-%d", $num, $inside),] {} # some resource
|
|
}
|
|
$some_value2 = 13 # check that non-ordering works too!
|
|
|
|
# We *don't* unnecessarily copy `4` on each include, because it's static!
|
|
include foo(1)
|
|
include foo(2)
|
|
include foo(3)
|
|
-- OUTPUT --
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: FuncValue -> call # fn
|
|
Edge: call -> composite: []str # 0
|
|
Edge: call -> composite: []str # 0
|
|
Edge: call -> composite: []str # 0
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: FuncValue
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: call
|
|
Vertex: composite: []str
|
|
Vertex: composite: []str
|
|
Vertex: composite: []str
|
|
Vertex: const: int(1)
|
|
Vertex: const: int(13)
|
|
Vertex: const: int(2)
|
|
Vertex: const: int(3)
|
|
Vertex: const: int(4)
|
|
Vertex: const: int(4)
|
|
Vertex: const: int(4)
|
|
Vertex: const: int(42)
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("+")
|
|
Vertex: const: str("test-%d-%d")
|
|
Vertex: const: str("test-%d-%d")
|
|
Vertex: const: str("test-%d-%d")
|