diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-30 15:50:54 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-30 15:50:54 -0500 |
| commit | 40c33987fa0a91a8525d960f8494ca9ddf12806d (patch) | |
| tree | fa89233cbd7096de735348b39704e1ddb97dfe0c /examples/tomodeps | |
| parent | f3fc7558bb425c4bd59b55527d2fafaa744fe0aa (diff) | |
Bring back `table[key]` syntax
Diffstat (limited to 'examples/tomodeps')
| -rw-r--r-- | examples/tomodeps/tomodeps.tm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm index fbe297ec..1f42850b 100644 --- a/examples/tomodeps/tomodeps.tm +++ b/examples/tomodeps/tomodeps.tm @@ -28,7 +28,7 @@ func _get_file_dependencies(file:Path -> {Dependency}): func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependency}}): return if dependencies:has(dep) - dependencies:set(dep, {:Dependency}) # Placeholder + dependencies[dep] = {:Dependency} # Placeholder dep_deps := when dep is File(path): _get_file_dependencies(path) @@ -50,7 +50,7 @@ func _build_dependency_graph(dep:Dependency, dependencies:@{Dependency:{Dependen module_deps:add(file_dep) module_deps[] - dependencies:set(dep, dep_deps) + dependencies[dep] = dep_deps for dep2 in dep_deps: _build_dependency_graph(dep2, dependencies) @@ -80,7 +80,7 @@ func _draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}, already_ child_prefix := prefix ++ (if is_last: " " else: "│ ") - children := dependencies:get(dep) or {:Dependency} + children := dependencies[dep] or {:Dependency} for i,child in children.items: is_child_last := (i == children.length) _draw_tree(child, dependencies, already_printed, child_prefix, is_child_last) @@ -89,7 +89,7 @@ func draw_tree(dep:Dependency, dependencies:{Dependency:{Dependency}}): printed := @{:Dependency} say(_printable_name(dep)) printed:add(dep) - deps := dependencies:get(dep) or {:Dependency} + deps := dependencies[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) |
