1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +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

@ -113,9 +113,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o
// 2. Assert: Each element of types is Boolean, String, or Number.
// 3. Let value be ? Get(options, property).
auto value = options.get(property);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
auto value = TRY(options.get(property));
// 4. If value is undefined, return fallback.
if (value.is_undefined())
@ -1051,9 +1049,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object,
// 3. For each value property of fieldNames, do
for (auto& property : field_names) {
// a. Let value be ? Get(fields, property).
auto value = fields.get(property);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
auto value = TRY(fields.get(property));
// b. If value is undefined, then
if (value.is_undefined()) {