Files
mgmt/lang/interpret_test/TestAstFunc1/doubleclass.txtar
James Shubin 51cf1e2921 lang: ast: The res and edge names should not use exclusives
This removes the exclusive from the res names and edge names. We now
require that the names should be lists of strings, however they can
still be single strings if that can be determined statically.
Programmers should explicitly wrap their variables in a string by
interpolation to force this, or in square brackets to force a list. The
former is generally preferable because it generates a small function
graph since it doesn't need to build a list.
2024-04-18 00:07:53 -04:00

68 lines
1.4 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 # 0
Edge: call -> composite # 0
Edge: call -> composite # 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
Vertex: composite
Vertex: composite
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const