1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

LibJS: Use the function's bound |this| and bound arguments in

Interpreter::call()
This commit is contained in:
Jack Karamanian 2020-05-30 01:07:02 -05:00 committed by Andreas Kling
parent 3ffb0a4e87
commit f4129ac422
2 changed files with 14 additions and 2 deletions

View file

@ -207,9 +207,10 @@ Value Interpreter::call(Function& function, Value this_value, Optional<MarkedVal
{
auto& call_frame = push_call_frame();
call_frame.function_name = function.name();
call_frame.this_value = this_value;
call_frame.this_value = function.bound_this().value_or(this_value);
call_frame.arguments = function.bound_arguments();
if (arguments.has_value())
call_frame.arguments = arguments.value().values();
call_frame.arguments.append(arguments.value().values());
call_frame.environment = function.create_environment();
auto result = function.call(*this);
pop_call_frame();