summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-21 20:09:59 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-21 22:31:31 +0100
commitc043b818ad390be4da8603abb1b27953e78965ac (patch)
tree2f89f024438cd16fed8bf43209ab4b8d6d0d49d2 /Userland
parent2093128b24c1ef17404e4e625b6f380b25aa84b5 (diff)
downloadserenity-c043b818ad390be4da8603abb1b27953e78965ac.zip
LibJS: Convert Temporal.PlainDateTime functions to ThrowCompletionOr
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp20
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp251
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h62
4 files changed, 168 insertions, 169 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
index decb35c759..f0e46a0fd9 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
@@ -30,8 +30,8 @@ void PlainDateTimeConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.prototype, global_object.temporal_plain_date_time_prototype(), 0);
u8 attr = Attribute::Writable | Attribute::Configurable;
- define_old_native_function(vm.names.from, from, 1, attr);
- define_old_native_function(vm.names.compare, compare, 2, attr);
+ define_native_function(vm.names.from, from, 1, attr);
+ define_native_function(vm.names.compare, compare, 2, attr);
define_direct_property(vm.names.length, Value(3), Attribute::Configurable);
}
@@ -93,36 +93,36 @@ ThrowCompletionOr<Object*> PlainDateTimeConstructor::construct(FunctionObject& n
}
// 5.2.2 Temporal.PlainDateTime.from ( item [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.from
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimeConstructor::from)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimeConstructor::from)
{
auto item = vm.argument(0);
// 1. Set options to ? GetOptionsObject(options).
- auto* options = TRY_OR_DISCARD(get_options_object(global_object, vm.argument(1)));
+ auto* options = TRY(get_options_object(global_object, vm.argument(1)));
// 2. If Type(item) is Object and item has an [[InitializedTemporalDateTime]] internal slot, then
if (item.is_object() && is<PlainDateTime>(item.as_object())) {
auto& plain_date_time = static_cast<PlainDateTime&>(item.as_object());
// a. Perform ? ToTemporalOverflow(options).
- (void)TRY_OR_DISCARD(to_temporal_overflow(global_object, *options));
+ (void)TRY(to_temporal_overflow(global_object, *options));
// b. Return ? CreateTemporalDateTime(item.[[ISOYear]], item.[[ISOMonth]], item.[[ISODay]], item.[[ISOHour]], item.[[ISOMinute]], item.[[ISOSecond]], item.[[ISOMillisecond]], item.[[ISOMicrosecond]], item.[[ISONanosecond]], item.[[Calendar]]).
- return TRY_OR_DISCARD(create_temporal_date_time(global_object, plain_date_time.iso_year(), plain_date_time.iso_month(), plain_date_time.iso_day(), plain_date_time.iso_hour(), plain_date_time.iso_minute(), plain_date_time.iso_second(), plain_date_time.iso_millisecond(), plain_date_time.iso_microsecond(), plain_date_time.iso_nanosecond(), plain_date_time.calendar()));
+ return TRY(create_temporal_date_time(global_object, plain_date_time.iso_year(), plain_date_time.iso_month(), plain_date_time.iso_day(), plain_date_time.iso_hour(), plain_date_time.iso_minute(), plain_date_time.iso_second(), plain_date_time.iso_millisecond(), plain_date_time.iso_microsecond(), plain_date_time.iso_nanosecond(), plain_date_time.calendar()));
}
// 3. Return ? ToTemporalDateTime(item, options).
- return TRY_OR_DISCARD(to_temporal_date_time(global_object, item, options));
+ return TRY(to_temporal_date_time(global_object, item, options));
}
// 5.2.3 Temporal.PlainDateTime.compare ( one, two ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.compare
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimeConstructor::compare)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimeConstructor::compare)
{
// 1. Set one to ? ToTemporalDateTime(one).
- auto* one = TRY_OR_DISCARD(to_temporal_date_time(global_object, vm.argument(0)));
+ auto* one = TRY(to_temporal_date_time(global_object, vm.argument(0)));
// 2. Set two to ? ToTemporalDateTime(two).
- auto two = TRY_OR_DISCARD(to_temporal_date_time(global_object, vm.argument(1)));
+ auto two = TRY(to_temporal_date_time(global_object, vm.argument(1)));
// 3. Return 𝔽(! CompareISODateTime(one.[[ISOYear]], one.[[ISOMonth]], one.[[ISODay]], one.[[ISOHour]], one.[[ISOMinute]], one.[[ISOSecond]], one.[[ISOMillisecond]], one.[[ISOMicrosecond]], one.[[ISONanosecond]], two.[[ISOYear]], two.[[ISOMonth]], two.[[ISODay]], two.[[ISOHour]], two.[[ISOMinute]], two.[[ISOSecond]], two.[[ISOMillisecond]], two.[[ISOMicrosecond]], two.[[ISONanosecond]])).
return Value(compare_iso_date_time(one->iso_year(), one->iso_month(), one->iso_day(), one->iso_hour(), one->iso_minute(), one->iso_second(), one->iso_millisecond(), one->iso_microsecond(), one->iso_nanosecond(), two->iso_year(), two->iso_month(), two->iso_day(), two->iso_hour(), two->iso_minute(), two->iso_second(), two->iso_millisecond(), two->iso_microsecond(), two->iso_nanosecond()));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h
index c561fb5723..67d448ef81 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h
@@ -24,8 +24,8 @@ public:
private:
virtual bool has_constructor() const override { return true; }
- JS_DECLARE_OLD_NATIVE_FUNCTION(from);
- JS_DECLARE_OLD_NATIVE_FUNCTION(compare);
+ JS_DECLARE_NATIVE_FUNCTION(from);
+ JS_DECLARE_NATIVE_FUNCTION(compare);
};
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp
index bdb5fb2491..8776355450 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp
@@ -30,374 +30,374 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
// 5.3.2 Temporal.PlainDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainDateTime"), Attribute::Configurable);
- define_old_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable);
- define_old_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable);
+ define_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
- define_old_native_function(vm.names.withPlainTime, with_plain_time, 1, attr);
- define_old_native_function(vm.names.withPlainDate, with_plain_date, 1, attr);
- define_old_native_function(vm.names.withCalendar, with_calendar, 1, attr);
- define_old_native_function(vm.names.equals, equals, 1, attr);
- define_old_native_function(vm.names.valueOf, value_of, 0, attr);
- define_old_native_function(vm.names.toPlainDate, to_plain_date, 0, attr);
- define_old_native_function(vm.names.toPlainYearMonth, to_plain_year_month, 0, attr);
- define_old_native_function(vm.names.toPlainMonthDay, to_plain_month_day, 0, attr);
- define_old_native_function(vm.names.toPlainTime, to_plain_time, 0, attr);
- define_old_native_function(vm.names.getISOFields, get_iso_fields, 0, attr);
+ define_native_function(vm.names.withPlainTime, with_plain_time, 1, attr);
+ define_native_function(vm.names.withPlainDate, with_plain_date, 1, attr);
+ define_native_function(vm.names.withCalendar, with_calendar, 1, attr);
+ define_native_function(vm.names.equals, equals, 1, attr);
+ define_native_function(vm.names.valueOf, value_of, 0, attr);
+ define_native_function(vm.names.toPlainDate, to_plain_date, 0, attr);
+ define_native_function(vm.names.toPlainYearMonth, to_plain_year_month, 0, attr);
+ define_native_function(vm.names.toPlainMonthDay, to_plain_month_day, 0, attr);
+ define_native_function(vm.names.toPlainTime, to_plain_time, 0, attr);
+ define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr);
}
// 5.3.3 get Temporal.PlainDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.calendar
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::calendar_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::calendar_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return dateTime.[[Calendar]].
return Value(&date_time->calendar());
}
// 5.3.4 get Temporal.PlainDateTime.prototype.year, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.year
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarYear(calendar, dateTime).
- return Value(TRY_OR_DISCARD(calendar_year(global_object, calendar, *date_time)));
+ return Value(TRY(calendar_year(global_object, calendar, *date_time)));
}
// 5.3.5 get Temporal.PlainDateTime.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.month
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonth(calendar, dateTime).
- return Value(TRY_OR_DISCARD(calendar_month(global_object, calendar, *date_time)));
+ return Value(TRY(calendar_month(global_object, calendar, *date_time)));
}
// 5.3.6 get Temporal.PlainDateTime.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.monthcode
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::month_code_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_code_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonthCode(calendar, dateTime).
- return js_string(vm, TRY_OR_DISCARD(calendar_month_code(global_object, calendar, *date_time)));
+ return js_string(vm, TRY(calendar_month_code(global_object, calendar, *date_time)));
}
// 5.3.7 get Temporal.PlainDateTime.prototype.day, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.day
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDay(calendar, dateTime).
- return Value(TRY_OR_DISCARD(calendar_day(global_object, calendar, *date_time)));
+ return Value(TRY(calendar_day(global_object, calendar, *date_time)));
}
// 5.3.8 get Temporal.PlainDateTime.prototype.hour, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.hour
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISOHour]]).
return Value(date_time->iso_hour());
}
// 5.3.9 get Temporal.PlainDateTime.prototype.minute, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.minute
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISOMinute]]).
return Value(date_time->iso_minute());
}
// 5.3.10 get Temporal.PlainDateTime.prototype.second, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.second
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::second_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::second_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISOSecond]]).
return Value(date_time->iso_second());
}
// 5.3.11 get Temporal.PlainDateTime.prototype.millisecond, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.millisecond
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::millisecond_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::millisecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISOMillisecond]]).
return Value(date_time->iso_millisecond());
}
// 5.3.12 get Temporal.PlainDateTime.prototype.microsecond, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.microsecond
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISOMicrosecond]]).
return Value(date_time->iso_microsecond());
}
// 5.3.13 get Temporal.PlainDateTime.prototype.nanosecond, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.nanosecond
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return 𝔽(dateTime.[[ISONanosecond]]).
return Value(date_time->iso_nanosecond());
}
// 5.3.14 get Temporal.PlainDateTime.prototype.dayOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.dayofweek
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDayOfWeek(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_day_of_week(global_object, calendar, *date_time));
+ return TRY(calendar_day_of_week(global_object, calendar, *date_time));
}
// 5.3.15 get Temporal.PlainDateTime.prototype.dayOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.dayofyear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDayOfYear(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_day_of_year(global_object, calendar, *date_time));
+ return TRY(calendar_day_of_year(global_object, calendar, *date_time));
}
// 5.3.16 get Temporal.PlainDateTime.prototype.weekOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.weekofyear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarWeekOfYear(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_week_of_year(global_object, calendar, *date_time));
+ return TRY(calendar_week_of_year(global_object, calendar, *date_time));
}
// 5.3.17 get Temporal.PlainDateTime.prototype.daysInWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinweek
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInWeek(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_days_in_week(global_object, calendar, *date_time));
+ return TRY(calendar_days_in_week(global_object, calendar, *date_time));
}
// 5.3.18 get Temporal.PlainDateTime.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinmonth
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInMonth(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_days_in_month(global_object, calendar, *date_time));
+ return TRY(calendar_days_in_month(global_object, calendar, *date_time));
}
// 5.3.19 get Temporal.PlainDateTime.prototype.daysInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinyear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInYear(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_days_in_year(global_object, calendar, *date_time));
+ return TRY(calendar_days_in_year(global_object, calendar, *date_time));
}
// 5.3.20 get Temporal.PlainDateTime.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.monthsinyear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonthsInYear(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_months_in_year(global_object, calendar, *date_time));
+ return TRY(calendar_months_in_year(global_object, calendar, *date_time));
}
// 5.3.21 get Temporal.PlainDateTime.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.inleapyear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarInLeapYear(calendar, dateTime).
- return TRY_OR_DISCARD(calendar_in_leap_year(global_object, calendar, *date_time));
+ return TRY(calendar_in_leap_year(global_object, calendar, *date_time));
}
// 15.6.6.2 get Temporal.PlainDateTime.prototype.era, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.era
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::era_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_getter)
{
// 1. Let plainDateTime be the this value.
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
- auto* plain_date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* plain_date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
// 4. Return ? CalendarEra(calendar, plainDateTime).
- return TRY_OR_DISCARD(calendar_era(global_object, calendar, *plain_date_time));
+ return TRY(calendar_era(global_object, calendar, *plain_date_time));
}
// 15.6.6.3 get Temporal.PlainDateTime.prototype.eraYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.erayear
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::era_year_getter)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_year_getter)
{
// 1. Let plainDateTime be the this value.
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
- auto* plain_date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* plain_date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
// 4. Return ? CalendarEraYear(calendar, plainDateTime).
- return TRY_OR_DISCARD(calendar_era_year(global_object, calendar, *plain_date_time));
+ return TRY(calendar_era_year(global_object, calendar, *plain_date_time));
}
// 5.3.23 Temporal.PlainDateTime.prototype.withPlainTime ( [ plainTimeLike ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.withplaintime
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_time)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_time)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. If plainTimeLike is undefined, then
if (vm.argument(0).is_undefined()) {
// a. Return ? CreateTemporalDateTime(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], 0, 0, 0, 0, 0, 0, dateTime.[[Calendar]]).
- return TRY_OR_DISCARD(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), 0, 0, 0, 0, 0, 0, date_time->calendar()));
+ return TRY(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), 0, 0, 0, 0, 0, 0, date_time->calendar()));
}
// 4. Let plainTime be ? ToTemporalTime(plainTimeLike).
- auto* plain_time = TRY_OR_DISCARD(to_temporal_time(global_object, vm.argument(0)));
+ auto* plain_time = TRY(to_temporal_time(global_object, vm.argument(0)));
// 5. Return ? CreateTemporalDateTime(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], plainTime.[[ISOHour]], plainTime.[[ISOMinute]], plainTime.[[ISOSecond]], plainTime.[[ISOMillisecond]], plainTime.[[ISOMicrosecond]], plainTime.[[ISONanosecond]], dateTime.[[Calendar]]).
- return TRY_OR_DISCARD(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), plain_time->iso_hour(), plain_time->iso_minute(), plain_time->iso_second(), plain_time->iso_millisecond(), plain_time->iso_microsecond(), plain_time->iso_nanosecond(), date_time->calendar()));
+ return TRY(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), plain_time->iso_hour(), plain_time->iso_minute(), plain_time->iso_second(), plain_time->iso_millisecond(), plain_time->iso_microsecond(), plain_time->iso_nanosecond(), date_time->calendar()));
}
// 5.3.24 Temporal.PlainDateTime.prototype.withPlainDate ( plainDateLike ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.withplaindate
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_date)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_date)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let plainDate be ? ToTemporalDate(plainDateLike).
- auto* plain_date = TRY_OR_DISCARD(to_temporal_date(global_object, vm.argument(0)));
+ auto* plain_date = TRY(to_temporal_date(global_object, vm.argument(0)));
// 4. Let calendar be ? ConsolidateCalendars(dateTime.[[Calendar]], plainDate.[[Calendar]]).
- auto* calendar = TRY_OR_DISCARD(consolidate_calendars(global_object, date_time->calendar(), plain_date->calendar()));
+ auto* calendar = TRY(consolidate_calendars(global_object, date_time->calendar(), plain_date->calendar()));
// 5. Return ? CreateTemporalDateTime(plainDate.[[ISOYear]], plainDate.[[ISOMonth]], plainDate.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], calendar).
- return TRY_OR_DISCARD(create_temporal_date_time(global_object, plain_date->iso_year(), plain_date->iso_month(), plain_date->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), *calendar));
+ return TRY(create_temporal_date_time(global_object, plain_date->iso_year(), plain_date->iso_month(), plain_date->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), *calendar));
}
// 5.3.25 Temporal.PlainDateTime.prototype.withCalendar ( calendar ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.withcalendar
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::with_calendar)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_calendar)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be ? ToTemporalCalendar(calendar).
- auto* calendar = TRY_OR_DISCARD(to_temporal_calendar(global_object, vm.argument(0)));
+ auto* calendar = TRY(to_temporal_calendar(global_object, vm.argument(0)));
// 4. Return ? CreateTemporalDateTime(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], calendar).
- return TRY_OR_DISCARD(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), *calendar));
+ return TRY(create_temporal_date_time(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), *calendar));
}
// 5.3.31 Temporal.PlainDateTime.prototype.equals ( other ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.equals
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::equals)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::equals)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Set other to ? ToTemporalDateTime(other).
- auto* other = TRY_OR_DISCARD(to_temporal_date_time(global_object, vm.argument(0)));
+ auto* other = TRY(to_temporal_date_time(global_object, vm.argument(0)));
// 4. Let result be ! CompareISODateTime(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], other.[[ISOYear]], other.[[ISOMonth]], other.[[ISODay]], other.[[ISOHour]], other.[[ISOMinute]], other.[[ISOSecond]], other.[[ISOMillisecond]], other.[[ISOMicrosecond]], other.[[ISONanosecond]]).
auto result = compare_iso_date_time(date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), other->iso_year(), other->iso_month(), other->iso_day(), other->iso_hour(), other->iso_minute(), other->iso_second(), other->iso_millisecond(), other->iso_microsecond(), other->iso_nanosecond());
@@ -407,85 +407,84 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::equals)
return Value(false);
// 6. Return ? CalendarEquals(dateTime.[[Calendar]], other.[[Calendar]]).
- return Value(TRY_OR_DISCARD(calendar_equals(global_object, date_time->calendar(), other->calendar())));
+ return Value(TRY(calendar_equals(global_object, date_time->calendar(), other->calendar())));
}
// 5.3.35 Temporal.PlainDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.valueof
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::value_of)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::value_of)
{
// 1. Throw a TypeError exception.
- vm.throw_exception<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainDateTime", "a primitive value");
- return {};
+ return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainDateTime", "a primitive value");
}
// 5.3.37 Temporal.PlainDateTime.prototype.toPlainDate ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplaindate
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_date)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_date)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return ? CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
- return TRY_OR_DISCARD(create_temporal_date(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar()));
+ return TRY(create_temporal_date(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar()));
}
// 5.3.38 Temporal.PlainDateTime.prototype.toPlainYearMonth ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplainyearmonth
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Let fieldNames be ? CalendarFields(calendar, « "monthCode", "year" »).
- auto field_names = TRY_OR_DISCARD(calendar_fields(global_object, calendar, { "monthCode"sv, "year"sv }));
+ auto field_names = TRY(calendar_fields(global_object, calendar, { "monthCode"sv, "year"sv }));
// 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»).
- auto* fields = TRY_OR_DISCARD(prepare_temporal_fields(global_object, *date_time, field_names, {}));
+ auto* fields = TRY(prepare_temporal_fields(global_object, *date_time, field_names, {}));
// 6. Return ? YearMonthFromFields(calendar, fields).
- return TRY_OR_DISCARD(year_month_from_fields(global_object, calendar, *fields));
+ return TRY(year_month_from_fields(global_object, calendar, *fields));
}
// 5.3.39 Temporal.PlainDateTime.prototype.toPlainMonthDay ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplainmonthday
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Let fieldNames be ? CalendarFields(calendar, « "day", "monthCode" »).
- auto field_names = TRY_OR_DISCARD(calendar_fields(global_object, calendar, { "day"sv, "monthCode"sv }));
+ auto field_names = TRY(calendar_fields(global_object, calendar, { "day"sv, "monthCode"sv }));
// 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»).
- auto* fields = TRY_OR_DISCARD(prepare_temporal_fields(global_object, *date_time, field_names, {}));
+ auto* fields = TRY(prepare_temporal_fields(global_object, *date_time, field_names, {}));
// 6. Return ? MonthDayFromFields(calendar, fields).
- return TRY_OR_DISCARD(month_day_from_fields(global_object, calendar, *fields));
+ return TRY(month_day_from_fields(global_object, calendar, *fields));
}
// 5.3.40 Temporal.PlainDateTime.prototype.toPlainTime ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplaintime
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_time)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_time)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Return ? CreateTemporalTime(dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]).
- return TRY_OR_DISCARD(create_temporal_time(global_object, date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond()));
+ return TRY(create_temporal_time(global_object, date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond()));
}
// 5.3.41 Temporal.PlainDateTime.prototype.getISOFields ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.getisofields
-JS_DEFINE_OLD_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields)
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
- auto* date_time = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* date_time = TRY(typed_this_object(global_object));
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(global_object, global_object.object_prototype());
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h
index 5a10b778aa..5470d1c72e 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h
@@ -20,37 +20,37 @@ public:
virtual ~PlainDateTimePrototype() override = default;
private:
- JS_DECLARE_OLD_NATIVE_FUNCTION(calendar_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(month_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(month_code_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(day_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(hour_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(minute_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(second_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(millisecond_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(microsecond_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(nanosecond_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(day_of_week_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(day_of_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(week_of_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(days_in_week_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(days_in_month_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(days_in_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(months_in_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(in_leap_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(era_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(era_year_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(with_plain_time);
- JS_DECLARE_OLD_NATIVE_FUNCTION(with_plain_date);
- JS_DECLARE_OLD_NATIVE_FUNCTION(with_calendar);
- JS_DECLARE_OLD_NATIVE_FUNCTION(equals);
- JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
- JS_DECLARE_OLD_NATIVE_FUNCTION(to_plain_date);
- JS_DECLARE_OLD_NATIVE_FUNCTION(to_plain_year_month);
- JS_DECLARE_OLD_NATIVE_FUNCTION(to_plain_month_day);
- JS_DECLARE_OLD_NATIVE_FUNCTION(to_plain_time);
- JS_DECLARE_OLD_NATIVE_FUNCTION(get_iso_fields);
+ JS_DECLARE_NATIVE_FUNCTION(calendar_getter);
+ JS_DECLARE_NATIVE_FUNCTION(year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(month_getter);
+ JS_DECLARE_NATIVE_FUNCTION(month_code_getter);
+ JS_DECLARE_NATIVE_FUNCTION(day_getter);
+ JS_DECLARE_NATIVE_FUNCTION(hour_getter);
+ JS_DECLARE_NATIVE_FUNCTION(minute_getter);
+ JS_DECLARE_NATIVE_FUNCTION(second_getter);
+ JS_DECLARE_NATIVE_FUNCTION(millisecond_getter);
+ JS_DECLARE_NATIVE_FUNCTION(microsecond_getter);
+ JS_DECLARE_NATIVE_FUNCTION(nanosecond_getter);
+ JS_DECLARE_NATIVE_FUNCTION(day_of_week_getter);
+ JS_DECLARE_NATIVE_FUNCTION(day_of_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(week_of_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(days_in_week_getter);
+ JS_DECLARE_NATIVE_FUNCTION(days_in_month_getter);
+ JS_DECLARE_NATIVE_FUNCTION(days_in_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(months_in_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(in_leap_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(era_getter);
+ JS_DECLARE_NATIVE_FUNCTION(era_year_getter);
+ JS_DECLARE_NATIVE_FUNCTION(with_plain_time);
+ JS_DECLARE_NATIVE_FUNCTION(with_plain_date);
+ JS_DECLARE_NATIVE_FUNCTION(with_calendar);
+ JS_DECLARE_NATIVE_FUNCTION(equals);
+ JS_DECLARE_NATIVE_FUNCTION(value_of);
+ JS_DECLARE_NATIVE_FUNCTION(to_plain_date);
+ JS_DECLARE_NATIVE_FUNCTION(to_plain_year_month);
+ JS_DECLARE_NATIVE_FUNCTION(to_plain_month_day);
+ JS_DECLARE_NATIVE_FUNCTION(to_plain_time);
+ JS_DECLARE_NATIVE_FUNCTION(get_iso_fields);
};
}