aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-05 02:13:24 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-05 02:13:24 -0400
commit486f2153e84f2b82ddffc601de75289cddb9c942 (patch)
tree6852412958366d52d9b5b40b5748434f44079ef8 /examples
parent81316e0d9704834a0a648cf84401b968933b7581 (diff)
Misc fixes
Diffstat (limited to 'examples')
-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 8da64eb2..8c75173a 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -27,7 +27,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[dep] = {} # Placeholder
@@ -57,7 +57,7 @@ func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency,{Dependen
for dep2 in dep_deps:
_build_dependency_graph(dep2, dependencies)
-func get_dependency_graph(dep:Dependency -> {Dependency,{Dependency}}):
+func get_dependency_graph(dep:Dependency -> {Dependency={Dependency}}):
graph : @{Dependency={Dependency}} = @{}
_build_dependency_graph(dep, graph)
return graph
@@ -72,7 +72,7 @@ func _printable_name(dep:Dependency -> Text):
else:
return "$(\x1b)[31;1m$(f) (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
@@ -82,16 +82,16 @@ func _draw_tree(dep:Dependency, dependencies:{Dependency,{Dependency}}, already_
child_prefix := prefix ++ (if is_last: " " else: "│ ")
- children := dependencies[dep] or {}
+ children := dependencies[dep] or {/}
for i,child in children.items:
is_child_last := (i == children.length)
_draw_tree(child, dependencies, already_printed, child_prefix, is_child_last)
-func draw_tree(dep:Dependency, dependencies:{Dependency,{Dependency}}):
+func draw_tree(dep:Dependency, dependencies:{Dependency={Dependency}}):
printed : @{Dependency} = @{}
say(_printable_name(dep))
printed:add(dep)
- deps := dependencies[dep] or {}
+ deps := dependencies[dep] or {/}
for i,child in deps.items:
is_child_last := (i == deps.length)
_draw_tree(child, dependencies, already_printed=printed, is_last=is_child_last)