mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibJS: Convert can_declare_global_function() to ThrowCompletionOr
This commit is contained in:
parent
215a56b0e4
commit
8296d3fbd2
4 changed files with 14 additions and 12 deletions
|
@ -627,9 +627,11 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
return IterationDecision::Continue;
|
||||
|
||||
if (global_var_environment) {
|
||||
auto function_definable = global_var_environment->can_declare_global_function(function.name());
|
||||
if (vm.exception())
|
||||
auto function_definable_or_error = global_var_environment->can_declare_global_function(function.name());
|
||||
if (function_definable_or_error.is_error())
|
||||
return IterationDecision::Break;
|
||||
auto function_definable = function_definable_or_error.release_value();
|
||||
|
||||
if (!function_definable) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function.name());
|
||||
return IterationDecision::Break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue