LibJS: FunctionEnvironment.[[FunctionObject]] is the *invoked* function

We were setting the wrong [[FunctionObject]] on the environment when
going through ProxyObject and BoundFunction.
This commit is contained in:
Andreas Kling 2021-06-25 20:14:17 +02:00
commit b650d11dd3
Notes: sideshowbarker 2024-07-18 11:30:45 +09:00
10 changed files with 14 additions and 14 deletions

View file

@ -425,7 +425,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal
callee_context.arguments = function.bound_arguments();
if (arguments.has_value())
callee_context.arguments.extend(arguments.value().values());
auto* environment = function.create_environment_record();
auto* environment = function.create_environment_record(function);
callee_context.lexical_environment = environment;
callee_context.variable_environment = environment;
if (environment)
@ -529,7 +529,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
callee_context.arguments = function.bound_arguments();
if (arguments.has_value())
callee_context.arguments.extend(arguments.value().values());
auto* environment = function.create_environment_record();
auto* environment = function.create_environment_record(function);
callee_context.lexical_environment = environment;
callee_context.variable_environment = environment;