Debian Codegraph @

lang/interpret_test/TestAstFunc1/doubleclass.txtar

raw
1 -- main.mcl --
2 import "fmt"
3
4 # this value should only be built once
5 $some_value1 = 42 # or something more complex like the output of a slow function...
6 class foo($num) {
7 # we should have a different `$inside` value for each use of this class
8 $inside = $some_value1 + $some_value2 + 4
9 test [fmt.printf("test-%d-%d", $num, $inside),] {} # some resource
10 }
11 $some_value2 = 13 # check that non-ordering works too!
12
13 # We *don't* unnecessarily copy `4` on each include, because it's static!
14 include foo(1)
15 include foo(2)
16 include foo(3)
17 -- OUTPUT --
18 Edge: FuncValue -> call # fn
19 Edge: FuncValue -> call # fn
20 Edge: FuncValue -> call # fn
21 Edge: FuncValue -> call # fn
22 Edge: FuncValue -> call # fn
23 Edge: FuncValue -> call # fn
24 Edge: FuncValue -> call # fn
25 Edge: FuncValue -> call # fn
26 Edge: FuncValue -> call # fn
27 Edge: call -> composite # 0
28 Edge: call -> composite # 0
29 Edge: call -> composite # 0
30 Vertex: FuncValue
31 Vertex: FuncValue
32 Vertex: FuncValue
33 Vertex: FuncValue
34 Vertex: FuncValue
35 Vertex: FuncValue
36 Vertex: FuncValue
37 Vertex: FuncValue
38 Vertex: FuncValue
39 Vertex: call
40 Vertex: call
41 Vertex: call
42 Vertex: call
43 Vertex: call
44 Vertex: call
45 Vertex: call
46 Vertex: call
47 Vertex: call
48 Vertex: composite
49 Vertex: composite
50 Vertex: composite
51 Vertex: const
52 Vertex: const
53 Vertex: const
54 Vertex: const
55 Vertex: const
56 Vertex: const
57 Vertex: const
58 Vertex: const
59 Vertex: const
60 Vertex: const
61 Vertex: const
62 Vertex: const
63 Vertex: const
64 Vertex: const
65 Vertex: const
66 Vertex: const
67 Vertex: const