1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00

LibJS: Convert Object::get() to ThrowCompletionOr

To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
This commit is contained in:
Linus Groh 2021-10-02 23:52:27 +01:00
parent 9b6c09e2c4
commit b7e5f08e56
61 changed files with 326 additions and 686 deletions

View file

@ -35,13 +35,9 @@ bool ObjectEnvironment::has_binding(FlyString const& name) const
return false;
if (!m_with_environment)
return true;
auto unscopables = m_binding_object.get(*vm.well_known_symbol_unscopables());
if (vm.exception())
return {};
auto unscopables = TRY_OR_DISCARD(m_binding_object.get(*vm.well_known_symbol_unscopables()));
if (unscopables.is_object()) {
auto blocked = unscopables.as_object().get(name);
if (vm.exception())
return {};
auto blocked = TRY_OR_DISCARD(unscopables.as_object().get(name));
if (blocked.to_boolean())
return false;
}
@ -110,7 +106,7 @@ Value ObjectEnvironment::get_binding_value(GlobalObject& global_object, FlyStrin
global_object.vm().throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, name);
return {};
}
return m_binding_object.get(name);
return TRY_OR_DISCARD(m_binding_object.get(name));
}
// 9.1.1.2.7 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-object-environment-records-deletebinding-n