1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 17:15:08 +00:00

LibJS: Convert the InitializeReferencedBinding AO to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-11-02 19:27:29 +02:00 committed by Linus Groh
parent 1aaaf521b8
commit 853fab352d
4 changed files with 15 additions and 33 deletions

View file

@ -426,12 +426,9 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
return throw_completion(exception->value());
// Here the difference from hasDuplicates is important
if (has_duplicates)
TRY(reference.put_value(global_object(), argument_value));
return reference.put_value(global_object(), argument_value);
else
reference.initialize_referenced_binding(global_object(), argument_value);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
return {};
return reference.initialize_referenced_binding(global_object(), argument_value);
} else if (IsSame<NonnullRefPtr<BindingPattern> const&, decltype(param)>) {
// Here the difference from hasDuplicates is important
return vm.binding_initialization(param, argument_value, used_environment, global_object());