LibJS: Always init arguments stored in locals for generator functions

Since AST interpreter switches to bytecode to execute generator
functions, arguments stored in local variables always need to be
initialized for such functions.
This commit is contained in:
Aliaksandr Kalenik 2023-07-07 20:39:26 +02:00 committed by Andreas Kling
parent e5b70837de
commit 71c54dd37b

View file

@ -479,7 +479,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
Environment* used_environment = has_duplicates ? nullptr : environment;
if constexpr (IsSame<NonnullRefPtr<Identifier const> const&, decltype(param)>) {
if (vm.bytecode_interpreter_if_exists() && param->is_local()) {
if ((vm.bytecode_interpreter_if_exists() || kind() == FunctionKind::Generator) && param->is_local()) {
// NOTE: Local variables are supported only in bytecode interpreter
callee_context.local_variables[param->local_variable_index()] = argument_value;
return {};