diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 19:20:07 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 19:20:07 -0400 |
| commit | 1d2e55f53dfab5153dbfd0c03f28cd9daedb3b77 (patch) | |
| tree | aa1c21191800467abe0b3d16cb6c2a0c2e4587f9 /examples/tomodeps/tomodeps.tm | |
| parent | bc93dea8186168aa015b05a615bc1873173393b5 (diff) | |
Allow uninitialized variables when there's a sensible empty value
(defaults to empty/zero value)
Diffstat (limited to 'examples/tomodeps/tomodeps.tm')
| -rw-r--r-- | examples/tomodeps/tomodeps.tm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm index 1181f2be..1e6be615 100644 --- a/examples/tomodeps/tomodeps.tm +++ b/examples/tomodeps/tomodeps.tm @@ -16,7 +16,7 @@ func _get_file_dependencies(file:Path -> |Dependency|) say("Could not read file: $file") return || - deps : @|Dependency| = @|| + deps : @|Dependency| if lines := file.by_line() for line in lines if line.matches_pattern($Pat/use {..}.tm/) @@ -36,8 +36,8 @@ 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| = @|| + module_deps : @|Dependency| + visited : @|Path| unvisited := @|f.resolved() for f in dir.files() if f.extension() == ".tm"| while unvisited.length > 0 file := unvisited.items[-1] @@ -58,7 +58,7 @@ 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|} = @{} + graph : @{Dependency=|Dependency|} _build_dependency_graph(dep, graph) return graph @@ -88,7 +88,7 @@ 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[dep] or || |
