Skip to content

Commit f816d42

Browse files
committed
cache has_hidden_fragments flag in chunks
1 parent 1799f57 commit f816d42

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

evolved.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ local __query_sorted_excludes = {} ---@type table<evolved.query, evolved.assoc_l
124124
---@field package __has_assign_hooks boolean
125125
---@field package __has_insert_hooks boolean
126126
---@field package __has_remove_hooks boolean
127+
---@field package __has_hidden_fragments boolean
127128
local __chunk_mt = {}
128129
__chunk_mt.__index = __chunk_mt
129130

@@ -1013,6 +1014,9 @@ local function __new_chunk(chunk_parent, chunk_fragment)
10131014
local has_remove_hooks = (chunk_parent and chunk_parent.__has_remove_hooks)
10141015
or __evolved_has(chunk_fragment, __ON_REMOVE)
10151016

1017+
local has_hidden_fragments = (chunk_parent and chunk_parent.__has_hidden_fragments)
1018+
or __evolved_has(chunk_fragment, __HIDDEN)
1019+
10161020
---@type evolved.chunk
10171021
local chunk = __lua_setmetatable({
10181022
__parent = nil,
@@ -1036,6 +1040,7 @@ local function __new_chunk(chunk_parent, chunk_fragment)
10361040
__has_assign_hooks = has_assign_hooks,
10371041
__has_insert_hooks = has_insert_hooks,
10381042
__has_remove_hooks = has_remove_hooks,
1043+
__has_hidden_fragments = has_hidden_fragments,
10391044
}, __chunk_mt)
10401045

10411046
if chunk_parent then
@@ -5023,10 +5028,14 @@ local function __update_chunk_caches_trace(chunk)
50235028
local has_remove_hooks = (chunk_parent and chunk_parent.__has_remove_hooks)
50245029
or __evolved_has(chunk_fragment, __ON_REMOVE)
50255030

5031+
local has_hidden_fragments = (chunk_parent and chunk_parent.__has_hidden_fragments)
5032+
or __evolved_has(chunk_fragment, __HIDDEN)
5033+
50265034
chunk.__has_setup_hooks = has_setup_hooks
50275035
chunk.__has_assign_hooks = has_assign_hooks
50285036
chunk.__has_insert_hooks = has_insert_hooks
50295037
chunk.__has_remove_hooks = has_remove_hooks
5038+
chunk.__has_hidden_fragments = has_hidden_fragments
50305039

50315040
return true
50325041
end
@@ -5118,6 +5127,10 @@ local function __update_fragment_tags(fragment)
51185127
__trace_fragment_chunks(fragment, __update_chunk_tags_trace, fragment)
51195128
end
51205129

5130+
local function __update_fragment_hiddens(fragment)
5131+
__trace_fragment_chunks(fragment, __update_chunk_caches_trace, fragment)
5132+
end
5133+
51215134
---@param fragment evolved.fragment
51225135
local function __update_fragment_defaults(fragment)
51235136
__trace_fragment_chunks(fragment, __update_chunk_caches_trace, fragment)
@@ -5131,6 +5144,9 @@ end
51315144
__evolved_set(__TAG, __ON_INSERT, __update_fragment_tags)
51325145
__evolved_set(__TAG, __ON_REMOVE, __update_fragment_tags)
51335146

5147+
__evolved_set(__HIDDEN, __ON_INSERT, __update_fragment_hiddens)
5148+
__evolved_set(__HIDDEN, __ON_REMOVE, __update_fragment_hiddens)
5149+
51345150
__evolved_set(__DEFAULT, __ON_INSERT, __update_fragment_defaults)
51355151
__evolved_set(__DEFAULT, __ON_REMOVE, __update_fragment_defaults)
51365152

0 commit comments

Comments
 (0)