aboutsummaryrefslogtreecommitdiff
path: root/examples/tomodeps
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-09 17:26:01 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-09 17:26:01 -0500
commit145a078387b8bce5e8e3c93c333c030aa7455e4c (patch)
tree48e113e07888a546bdf9543db2a19587aeef3071 /examples/tomodeps
parent8dd51a113ead1fe88c80af9165219ca5398715f6 (diff)
Make the compiler stricter about not promoting local value variables to
pointers
Diffstat (limited to 'examples/tomodeps')
-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 15655756..fbe297ec 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -14,7 +14,7 @@ func _get_file_dependencies(file:Path -> {Dependency}):
!! Could not read file: $file
return {:Dependency}
- deps := {:Dependency}
+ deps := @{:Dependency}
if lines := file:by_line():
for line in lines:
if line:matches($/use {..}.tm/):
@@ -23,7 +23,7 @@ func _get_file_dependencies(file:Path -> {Dependency}):
else if line:matches($/use {id}/):
module_name := line:replace($/use {..}/, "\1")
deps:add(Dependency.Module(module_name))
- return deps
+ return deps[]
func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependency}}):
return if dependencies:has(dep)
@@ -34,9 +34,9 @@ func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependen
_get_file_dependencies(path)
is Module(module):
dir := (~/.local/share/tomo/installed/$module)
- module_deps := {:Dependency}
- visited := {:Path}
- unvisited := {f:resolved() for f in dir:files() if f:ends_with(".tm")}
+ module_deps := @{:Dependency}
+ visited := @{:Path}
+ unvisited := @{f:resolved() for f in dir:files() if f:ends_with(".tm")}
while unvisited.length > 0:
file := unvisited.items[-1]
unvisited:remove(file)
@@ -48,7 +48,7 @@ func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependen
unvisited:add(f)
is Module(m):
module_deps:add(file_dep)
- module_deps
+ module_deps[]
dependencies:set(dep, dep_deps)