From e11843064827fafc8f599a24adffe4ae5bc3437b Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Fri, 26 Jan 2024 22:42:32 +1300 Subject: [PATCH] LibJS: Allow JS::create_heap_function to accept a lambda This helps us avoid from needing to construct a Function when invoking `create_heap_function` with a lambda. Co-Authored-By: Ali Mohammad Pur --- Userland/Libraries/LibJS/Heap/HeapFunction.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Heap/HeapFunction.h b/Userland/Libraries/LibJS/Heap/HeapFunction.h index 8b005c7b12..c357dc16d4 100644 --- a/Userland/Libraries/LibJS/Heap/HeapFunction.h +++ b/Userland/Libraries/LibJS/Heap/HeapFunction.h @@ -41,10 +41,10 @@ private: Function m_function; }; -template -static NonnullGCPtr> create_heap_function(Heap& heap, Function function) +template> +static NonnullGCPtr> create_heap_function(Heap& heap, Callable&& function) { - return HeapFunction::create(heap, move(function)); + return HeapFunction::create(heap, Function { forward(function) }); } }