Add check for destruction of active scope

This commit is contained in:
aaron 2024-11-13 21:56:22 +00:00
parent a1552402cb
commit 0897821e1f
3 changed files with 62 additions and 2 deletions

View file

@ -108,6 +108,10 @@ local function unparent<T>(node: Node<T>)
end
local function destroy<T>(node: Node<T>)
if flags.strict and table.find(scopes, node) then
throw("attempt to destroy an active scope")
end
flush_cleanups(node)
unparent(node)
@ -296,5 +300,7 @@ return table.freeze {
flush_update_queue = flush_update_queue,
get_update_queue_length = get_update_queue_length,
set_context = set_context,
scopes = scopes
scopes = scopes,
q = update_queue
}