mirror of
https://github.com/centau/vide.git
synced 2026-08-20 23:01:37 +00:00
Disallow creation of nested tracking scopes
This commit is contained in:
parent
c0c2166edf
commit
38342b3805
6 changed files with 256 additions and 109 deletions
|
|
@ -30,7 +30,7 @@ end
|
|||
local function indexes<K, VI, VO>(input: () -> Map<K, VI>, transform: (() -> VI, K) -> VO): () -> { VO }
|
||||
local owner = get_owning_scope()
|
||||
|
||||
local subowner = create_node(false, false)
|
||||
local subowner = create_node(false, "owner")
|
||||
set_owner(subowner, owner)
|
||||
|
||||
local input_cache = {} :: Map<K, VI>
|
||||
|
|
@ -67,7 +67,7 @@ local function indexes<K, VI, VO>(input: () -> Map<K, VI>, transform: (() -> VI,
|
|||
|
||||
if cv ~= v then
|
||||
if cv == nil then -- create new scope and run transform
|
||||
local scope = create_node(false, false)
|
||||
local scope = create_node(false, "owner")
|
||||
scopes[i] = scope :: Node<any>
|
||||
|
||||
local node = create_start_node(v)
|
||||
|
|
@ -112,6 +112,7 @@ local function indexes<K, VI, VO>(input: () -> Map<K, VI>, transform: (() -> VI,
|
|||
local node = create_node(false :: any, function()
|
||||
return update_children(input())
|
||||
end)
|
||||
set_owner(node, owner)
|
||||
|
||||
evaluate_node(node)
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ end
|
|||
local function values<K, VI, VO>(input: () -> Map<K, VI>, transform: (VI, () -> K) -> VO): () -> { VO }
|
||||
local owner = get_owning_scope()
|
||||
|
||||
local subowner = create_node(false, false)
|
||||
local subowner = create_node(false, "owner")
|
||||
set_owner(subowner, owner)
|
||||
|
||||
local cur_input_cache_up = {} :: Map<VI, K>
|
||||
|
|
@ -155,7 +156,7 @@ local function values<K, VI, VO>(input: () -> Map<K, VI>, transform: (VI, () ->
|
|||
local cv = cur_input_cache[v]
|
||||
|
||||
if cv == nil then -- create new scope and run transform
|
||||
local scope = create_node(false, false)
|
||||
local scope = create_node(false, "owner")
|
||||
scopes[v] = scope :: Node<any>
|
||||
|
||||
local node = create_start_node(i)
|
||||
|
|
@ -214,6 +215,7 @@ local function values<K, VI, VO>(input: () -> Map<K, VI>, transform: (VI, () ->
|
|||
local node = create_node(false :: any, function()
|
||||
return update_children(input())
|
||||
end)
|
||||
set_owner(node, owner)
|
||||
|
||||
evaluate_node(node)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue