Преглед на файлове

LibJS: Use forwarding references for call's variadic template arguments

Timothy Flynn преди 3 години
родител
ревизия
4661a0f228
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      Userland/Libraries/LibJS/Runtime/AbstractOperations.h

+ 4 - 4
Userland/Libraries/LibJS/Runtime/AbstractOperations.h

@@ -65,11 +65,11 @@ ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value f
 }
 
 template<typename... Args>
-ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, Args... args)
+ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, Args&&... args)
 {
     if constexpr (sizeof...(Args) > 0) {
         MarkedValueList arguments_list { global_object.heap() };
-        (..., arguments_list.append(move(args)));
+        (..., arguments_list.append(forward<Args>(args)));
         return call_impl(global_object, function, this_value, move(arguments_list));
     }
 
@@ -87,11 +87,11 @@ ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Functio
 }
 
 template<typename... Args>
-ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, Args... args)
+ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, Args&&... args)
 {
     if constexpr (sizeof...(Args) > 0) {
         MarkedValueList arguments_list { global_object.heap() };
-        (..., arguments_list.append(move(args)));
+        (..., arguments_list.append(forward<Args>(args)));
         return call_impl(global_object, function, this_value, move(arguments_list));
     }