mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +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
|
@ -3626,10 +3626,10 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
if (declared_function_names.set(function.name()) != AK::HashSetResult::InsertedNewEntry)
|
||||
return IterationDecision::Continue;
|
||||
|
||||
auto function_definable = global_environment.can_declare_global_function(function.name());
|
||||
|
||||
if (interpreter.exception())
|
||||
auto function_definable_or_error = global_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) {
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function.name());
|
||||
|
@ -3677,10 +3677,10 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
if (global_environment.has_lexical_declaration(function_name))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
auto function_definable = global_environment.can_declare_global_function(function_name);
|
||||
|
||||
if (interpreter.exception())
|
||||
auto function_definable_or_error = global_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) {
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue