1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibJS: Convert has_restricted_global_property() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-12-29 15:50:50 +01:00
parent 9571631b58
commit 1817c1f83c
3 changed files with 6 additions and 5 deletions

View file

@ -3593,9 +3593,10 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
return IterationDecision::Break;
}
auto restricted_global = global_environment.has_restricted_global_property(name);
if (interpreter.exception())
auto restricted_global_or_error = global_environment.has_restricted_global_property(name);
if (restricted_global_or_error.is_error())
return IterationDecision::Break;
auto restricted_global = restricted_global_or_error.release_value();
if (restricted_global)
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::RestrictedGlobalProperty, name);