diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-02 23:52:27 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-03 20:14:03 +0100 |
commit | b7e5f08e561696001d9b0ced8f3fe50caf186d2c (patch) | |
tree | debbec2ad0557cc166acc7f5777b023b44db080e /Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp | |
parent | 9b6c09e2c4ff79714dfecb4a98222bec9cc72b71 (diff) | |
download | serenity-b7e5f08e561696001d9b0ced8f3fe50caf186d2c.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp index fc6a7fb3ad..a70b448571 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp @@ -81,9 +81,7 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(GlobalObject& global_obj calendar_absent = false; } else { // i. Let calendar be ? Get(item, "calendar"). - auto calendar_value = item_object.get(vm.names.calendar); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); + auto calendar_value = TRY(item_object.get(vm.names.calendar)); // ii. If calendar is undefined, then // 1. Let calendarAbsent be true. @@ -102,19 +100,13 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(GlobalObject& global_obj auto* fields = TRY(prepare_temporal_fields(global_object, item_object, field_names, {})); // f. Let month be ? Get(fields, "month"). - auto month = fields->get(vm.names.month); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); + auto month = TRY(fields->get(vm.names.month)); // g. Let monthCode be ? Get(fields, "monthCode"). - auto month_code = fields->get(vm.names.monthCode); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); + auto month_code = TRY(fields->get(vm.names.monthCode)); // h. Let year be ? Get(fields, "year"). - auto year = fields->get(vm.names.year); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); + auto year = TRY(fields->get(vm.names.year)); // i. If calendarAbsent is true, and month is not undefined, and monthCode is undefined and year is undefined, then if (calendar_absent && !month.is_undefined() && month_code.is_undefined() && year.is_undefined()) { |