LibGC: Mark GC::Function and create_function as ESCAPING

Whenever we create a GC function, it should always be so that we can
pass it to a platform event loop spin, HTML event loop spin, or some
queued task on the HTML event loop. For every use case, any local
variables will be out of scope by the time the function executes.
This commit is contained in:
Andrew Kaster 2024-12-09 19:49:57 -07:00 committed by Andreas Kling
parent 66519af43f
commit 2f38c83caf
Notes: github-actions[bot] 2024-12-10 06:13:57 +00:00

View file

@ -17,7 +17,7 @@ class Function final : public Cell {
GC_CELL(Function, Cell);
public:
static Ref<Function> create(Heap& heap, AK::Function<T> function)
static Ref<Function> create(Heap& heap, ESCAPING AK::Function<T> function)
{
return heap.allocate<Function>(move(function));
}
@ -42,7 +42,7 @@ private:
};
template<typename Callable, typename T = EquivalentFunctionType<Callable>>
static Ref<Function<T>> create_function(Heap& heap, Callable&& function)
static Ref<Function<T>> create_function(Heap& heap, ESCAPING Callable&& function)
{
return Function<T>::create(heap, AK::Function<T> { forward<Callable>(function) });
}