mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibJS/Bytecode: Enable local variables for async generators
See8b64508
and71c54dd
This commit is contained in:
parent
53e527281f
commit
3373626dd5
1 changed files with 2 additions and 2 deletions
|
@ -479,7 +479,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
||||||
Environment* used_environment = has_duplicates ? nullptr : environment;
|
Environment* used_environment = has_duplicates ? nullptr : environment;
|
||||||
|
|
||||||
if constexpr (IsSame<NonnullRefPtr<Identifier const> const&, decltype(param)>) {
|
if constexpr (IsSame<NonnullRefPtr<Identifier const> const&, decltype(param)>) {
|
||||||
if ((vm.bytecode_interpreter_if_exists() || kind() == FunctionKind::Generator) && param->is_local()) {
|
if ((vm.bytecode_interpreter_if_exists() || kind() == FunctionKind::Generator || kind() == FunctionKind::AsyncGenerator) && param->is_local()) {
|
||||||
// NOTE: Local variables are supported only in bytecode interpreter
|
// NOTE: Local variables are supported only in bytecode interpreter
|
||||||
callee_context.local_variables[param->local_variable_index()] = argument_value;
|
callee_context.local_variables[param->local_variable_index()] = argument_value;
|
||||||
return {};
|
return {};
|
||||||
|
@ -616,7 +616,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
||||||
auto private_environment = callee_context.private_environment;
|
auto private_environment = callee_context.private_environment;
|
||||||
for (auto& declaration : functions_to_initialize) {
|
for (auto& declaration : functions_to_initialize) {
|
||||||
auto function = ECMAScriptFunctionObject::create(realm, declaration.name(), declaration.source_text(), declaration.body(), declaration.parameters(), declaration.function_length(), declaration.local_variables_names(), lex_environment, private_environment, declaration.kind(), declaration.is_strict_mode(), declaration.might_need_arguments_object(), declaration.contains_direct_call_to_eval());
|
auto function = ECMAScriptFunctionObject::create(realm, declaration.name(), declaration.source_text(), declaration.body(), declaration.parameters(), declaration.function_length(), declaration.local_variables_names(), lex_environment, private_environment, declaration.kind(), declaration.is_strict_mode(), declaration.might_need_arguments_object(), declaration.contains_direct_call_to_eval());
|
||||||
if ((vm.bytecode_interpreter_if_exists() || kind() == FunctionKind::Generator) && declaration.name_identifier()->is_local()) {
|
if ((vm.bytecode_interpreter_if_exists() || kind() == FunctionKind::Generator || kind() == FunctionKind::AsyncGenerator) && declaration.name_identifier()->is_local()) {
|
||||||
callee_context.local_variables[declaration.name_identifier()->local_variable_index()] = function;
|
callee_context.local_variables[declaration.name_identifier()->local_variable_index()] = function;
|
||||||
} else {
|
} else {
|
||||||
MUST(var_environment->set_mutable_binding(vm, declaration.name(), function, false));
|
MUST(var_environment->set_mutable_binding(vm, declaration.name(), function, false));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue