aboutsummaryrefslogtreecommitdiff
path: root/examples/tomodeps/tomodeps.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-28 13:53:15 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-28 13:53:15 -0400
commit9c302fdc34403f46572d9524309617888ba816bb (patch)
tree58ea7faf390536503de114cf2889ed85ba60df7b /examples/tomodeps/tomodeps.tm
parentc632a72486d347e7ef30c0b7890e2045ed42b903 (diff)
parentce2aebe91085f987aab31bd2a49820fb605cf386 (diff)
Merge branch 'main' into internal-textsinternal-texts
Diffstat (limited to 'examples/tomodeps/tomodeps.tm')
-rw-r--r--examples/tomodeps/tomodeps.tm12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm
index 907734a0..15655756 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -25,7 +25,7 @@ func _get_file_dependencies(file:Path -> {Dependency}):
deps:add(Dependency.Module(module_name))
return deps
-func _build_dependency_graph(dep:Dependency, dependencies:&{Dependency:{Dependency}}):
+func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependency}}):
return if dependencies:has(dep)
dependencies:set(dep, {:Dependency}) # Placeholder
@@ -56,8 +56,8 @@ func _build_dependency_graph(dep:Dependency, dependencies:&{Dependency:{Dependen
_build_dependency_graph(dep2, dependencies)
func get_dependency_graph(dep:Dependency -> {Dependency:{Dependency}}):
- graph := {:Dependency:{Dependency}}
- _build_dependency_graph(dep, &graph)
+ graph := @{:Dependency:{Dependency}}
+ _build_dependency_graph(dep, graph)
return graph
func _printable_name(dep:Dependency -> Text):
@@ -70,7 +70,7 @@ func _printable_name(dep:Dependency -> Text):
else:
return "$(\x1b)[31;1m$(f.text_content) (not found)$(\x1b)[m"
-func _draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}, already_printed:&{Dependency}, prefix="", is_last=yes):
+func _draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}, already_printed:@{Dependency}, prefix="", is_last=yes):
if already_printed:has(dep):
say(prefix ++ (if is_last: "└── " else: "├── ") ++ _printable_name(dep) ++ " $\x1b[2m(recursive)$\x1b[m")
return
@@ -86,13 +86,13 @@ func _draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}, already_
_draw_tree(child, dependencies, already_printed, child_prefix, is_child_last)
func draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}):
- printed := {:Dependency}
+ printed := @{:Dependency}
say(_printable_name(dep))
printed:add(dep)
deps := dependencies:get(dep) or {:Dependency}
for i,child in deps.items:
is_child_last := (i == deps.length)
- _draw_tree(child, dependencies, already_printed=&printed, is_last=is_child_last)
+ _draw_tree(child, dependencies, already_printed=printed, is_last=is_child_last)
func main(files:[Text]):
if files.length == 0: