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

LibJS: Convert PropertyKey::from_value() to ThrowCompletionOr

Lots of MUST() - perhaps we'll eventually come up with a better API for
the common case where it can't fail.
This commit is contained in:
Linus Groh 2022-01-04 22:33:30 +01:00
parent 62356cff40
commit 29e96eceeb
7 changed files with 23 additions and 25 deletions

View file

@ -277,7 +277,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors)
// 4. For each element key of ownKeys, do
for (auto& key : own_keys) {
auto property_name = PropertyKey::from_value(global_object, key);
auto property_name = MUST(PropertyKey::from_value(global_object, key));
// a. Let desc be ? obj.[[GetOwnProperty]](key).
auto desc = TRY(object->internal_get_own_property(property_name));
@ -411,7 +411,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::assign)
// iii. For each element nextKey of keys, do
for (auto& next_key : keys) {
auto property_name = PropertyKey::from_value(global_object, next_key);
auto property_name = MUST(PropertyKey::from_value(global_object, next_key));
// 1. Let desc be ? from.[[GetOwnProperty]](nextKey).
auto desc = TRY(from->internal_get_own_property(property_name));