mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibJS: Use forwarding references for call's variadic template arguments
This commit is contained in:
parent
5c4b1e3d23
commit
4661a0f228
Notes:
sideshowbarker
2024-07-17 20:13:33 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/4661a0f2281 Pull-request: https://github.com/SerenityOS/serenity/pull/12136
1 changed files with 4 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue