mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Stop resizing of weak tables
This commit is contained in:
parent
8ef2d0b190
commit
64d2a1f55c
1 changed files with 4 additions and 4 deletions
|
|
@ -15,10 +15,10 @@ local reff = false
|
||||||
-- array of all nodes referenced since above flag was set
|
-- array of all nodes referenced since above flag was set
|
||||||
local refs = {} :: { Node<unknown> }
|
local refs = {} :: { Node<unknown> }
|
||||||
|
|
||||||
local WEAK_VALUES_RESIZABLE = { __mode = "vs" }
|
local WEAK_VALUES = { __mode = "v" }
|
||||||
local EVALUATION_ERR = "error while evaluating source:\n\n"
|
local EVALUATION_ERR = "error while evaluating source:\n\n"
|
||||||
|
|
||||||
setmetatable(refs :: any, WEAK_VALUES_RESIZABLE)
|
setmetatable(refs :: any, WEAK_VALUES)
|
||||||
|
|
||||||
-- runs a given callback in a context that Luau does not allow yielding in
|
-- runs a given callback in a context that Luau does not allow yielding in
|
||||||
local check_for_yield: <T...>(fn: (T...) -> unknown, T...) -> () do
|
local check_for_yield: <T...>(fn: (T...) -> unknown, T...) -> () do
|
||||||
|
|
@ -87,7 +87,7 @@ local function set_child(parent: Node<unknown>, child: Node<unknown>)
|
||||||
table.insert(parent.children, child)
|
table.insert(parent.children, child)
|
||||||
else
|
else
|
||||||
parent.children = { child }
|
parent.children = { child }
|
||||||
setmetatable(parent.children :: any, WEAK_VALUES_RESIZABLE)
|
setmetatable(parent.children :: any, WEAK_VALUES)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ local function create<T>(value: T): (Node<T>, () -> T)
|
||||||
local node = {
|
local node = {
|
||||||
cache = value,
|
cache = value,
|
||||||
derive = function() return nil :: any end,
|
derive = function() return nil :: any end,
|
||||||
effects = setmetatable({}, WEAK_VALUES_RESIZABLE) :: any,
|
effects = setmetatable({}, WEAK_VALUES) :: any,
|
||||||
children = false :: false
|
children = false :: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue