mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibJS: Convert create_global_function_binding() to ThrowCompletionOr
This commit is contained in:
parent
4767be1459
commit
87a89e7126
4 changed files with 8 additions and 18 deletions
|
@ -746,9 +746,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
for (auto& declaration : functions_to_initialize) {
|
||||
auto* function = ECMAScriptFunctionObject::create(global_object, declaration.name(), declaration.body(), declaration.parameters(), declaration.function_length(), lexical_environment, private_environment, declaration.kind(), declaration.is_strict_mode(), declaration.might_need_arguments_object());
|
||||
if (global_var_environment) {
|
||||
global_var_environment->create_global_function_binding(declaration.name(), function, true);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
TRY(global_var_environment->create_global_function_binding(declaration.name(), function, true));
|
||||
} else {
|
||||
auto binding_exists = MUST(variable_environment->has_binding(declaration.name()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue