1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +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

@ -995,7 +995,7 @@ ThrowCompletionOr<Object*> default_merge_fields(GlobalObject& global_object, Obj
for (auto& next_key : original_keys) {
// a. If nextKey is not "month" or "monthCode", then
if (next_key.as_string().string() != vm.names.month.as_string() && next_key.as_string().string() != vm.names.monthCode.as_string()) {
auto property_name = PropertyKey::from_value(global_object, next_key);
auto property_name = MUST(PropertyKey::from_value(global_object, next_key));
// i. Let propValue be ? Get(fields, nextKey).
auto prop_value = TRY(fields.get(property_name));
@ -1016,7 +1016,7 @@ ThrowCompletionOr<Object*> default_merge_fields(GlobalObject& global_object, Obj
// 5. For each element nextKey of newKeys, do
for (auto& next_key : new_keys) {
auto property_name = PropertyKey::from_value(global_object, next_key);
auto property_name = MUST(PropertyKey::from_value(global_object, next_key));
// a. Let propValue be ? Get(additionalFields, nextKey).
auto prop_value = TRY(additional_fields.get(property_name));