Add check for recursive capturing

This commit is contained in:
aaron 2023-08-28 01:27:31 +01:00
parent fd323d7d39
commit f39774082a

View file

@ -119,6 +119,8 @@ end
-- detect what nodes were referenced in the given callback and returns them in an array -- detect what nodes were referenced in the given callback and returns them in an array
local function capture<T, U>(fn: (U?) -> T, arg: U?): ({ Node<unknown> }, T) local function capture<T, U>(fn: (U?) -> T, arg: U?): ({ Node<unknown> }, T)
if reff then throw("recursive capture detected") end
if flags.strict then check_for_yield(fn, arg) end if flags.strict then check_for_yield(fn, arg) end
table.clear(refs) table.clear(refs)