Optimize indexes() and values()

This commit is contained in:
aaron 2025-03-27 19:27:54 +00:00
parent 37e8e05206
commit 452ca383f7
11 changed files with 320 additions and 260 deletions

View file

@ -1,7 +1,7 @@
local graph = require "./graph"
type Node<T> = graph.Node<T>
local create_source_node = graph.create_source_node
local push_child_to_scope = graph.push_child_to_scope
local push_scope_as_child_of = graph.push_scope_as_child_of
local update_descendants = graph.update_descendants
export type Source<T> = (() -> T) & ((value: T) -> T)
@ -11,7 +11,7 @@ local function source<T>(initial_value: T): Source<T>
local function update_source(...): T
if select("#", ...) == 0 then -- no args were given
push_child_to_scope(node)
push_scope_as_child_of(node)
return node.cache
end