summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-28 23:48:56 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-28 23:48:56 +0100
commit4e4d8d69056373f1de72ce2ed9e28bf08f5e2c9b (patch)
tree1a507728ea4dc5773bd627b2e7132fcc8d35efb9
parent6340aa11cec752b007443f7549ee5ee7f4a7af3f (diff)
downloadserenity-4e4d8d69056373f1de72ce2ed9e28bf08f5e2c9b.zip
LibJS: Reflect infallibility editorial changes in the Temporal spec
See: - https://github.com/tc39/proposal-temporal/commit/3c0671f - https://github.com/tc39/proposal-temporal/commit/fe28b86
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp19
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp3
3 files changed, 10 insertions, 16 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index 0a6db4926d..0369fdb37e 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -81,7 +81,7 @@ Calendar* get_builtin_calendar(GlobalObject& global_object, String const& identi
// 12.1.4 GetISO8601Calendar ( )
Calendar* get_iso8601_calendar(GlobalObject& global_object)
{
- // 1. Return ? GetBuiltinCalendar("iso8601").
+ // 1. Return ! GetBuiltinCalendar("iso8601").
return get_builtin_calendar(global_object, "iso8601");
}
@@ -346,7 +346,7 @@ Object* to_temporal_calendar_with_iso_default(GlobalObject& global_object, Value
{
// 1. If temporalCalendarLike is undefined, then
if (temporal_calendar_like.is_undefined()) {
- // a. Return ? GetISO8601Calendar().
+ // a. Return ! GetISO8601Calendar().
return get_iso8601_calendar(global_object);
}
// 2. Return ? ToTemporalCalendar(temporalCalendarLike).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
index 9a3d6e855e..d1057f04bf 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
@@ -71,10 +71,8 @@ JS_DEFINE_NATIVE_FUNCTION(Now::plain_date_time_iso)
{
auto temporal_time_zone_like = vm.argument(0);
- // 1, Let calendar be ? GetISO8601Calendar().
+ // 1, Let calendar be ! GetISO8601Calendar().
auto* calendar = get_iso8601_calendar(global_object);
- if (vm.exception())
- return {};
// 2. Return ? SystemDateTime(temporalTimeZoneLike, calendar).
return system_date_time(global_object, temporal_time_zone_like, calendar);
@@ -91,7 +89,7 @@ JS_DEFINE_NATIVE_FUNCTION(Now::plain_date)
if (vm.exception())
return {};
- // 2. Return ? CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
+ // 2. Return ! CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
return create_temporal_date(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar());
}
@@ -100,17 +98,15 @@ JS_DEFINE_NATIVE_FUNCTION(Now::plain_date_iso)
{
auto temporal_time_zone_like = vm.argument(0);
- // 1. Let calendar be ? GetISO8601Calendar().
+ // 1. Let calendar be ! GetISO8601Calendar().
auto* calendar = get_iso8601_calendar(global_object);
- if (vm.exception())
- return {};
// 2. Let dateTime be ? SystemDateTime(temporalTimeZoneLike, calendar).
auto* date_time = system_date_time(global_object, temporal_time_zone_like, calendar);
if (vm.exception())
return {};
- // 3. Return ? CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
+ // 3. Return ! CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
return create_temporal_date(global_object, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar());
}
@@ -119,16 +115,15 @@ JS_DEFINE_NATIVE_FUNCTION(Now::plain_time_iso)
{
auto temporal_time_zone_like = vm.argument(0);
- // 1. Let calendar be ? GetISO8601Calendar().
- // NOTE: No exception check needed for GetISO8601Calendar, see https://github.com/tc39/proposal-temporal/pull/1643
+ // 1. Let calendar be ! GetISO8601Calendar().
auto* calendar = get_iso8601_calendar(global_object);
// 2. Let dateTime be ? SystemDateTime(temporalTimeZoneLike, calendar).
- auto date_time = system_date_time(global_object, temporal_time_zone_like, calendar);
+ auto* date_time = system_date_time(global_object, temporal_time_zone_like, calendar);
if (vm.exception())
return {};
- // 3. Return ? CreateTemporalTime(dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]).
+ // 3. Return ! CreateTemporalTime(dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]).
return 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());
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
index e29a72f124..4428d7b21a 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
@@ -154,8 +154,7 @@ PlainTime* create_temporal_time(GlobalObject& global_object, u8 hour, u8 minute,
// 8. Set object.[[ISOMillisecond]] to millisecond.
// 9. Set object.[[ISOMicrosecond]] to microsecond.
// 10. Set object.[[ISONanosecond]] to nanosecond.
- // 11. Set object.[[Calendar]] to ? GetISO8601Calendar().
- // NOTE: No exception check needed for GetISO8601Calendar, see https://github.com/tc39/proposal-temporal/pull/1643
+ // 11. Set object.[[Calendar]] to ! GetISO8601Calendar().
auto* object = ordinary_create_from_constructor<PlainTime>(global_object, *new_target, &GlobalObject::temporal_plain_time_prototype, hour, minute, second, millisecond, microsecond, nanosecond, *get_iso8601_calendar(global_object));
if (vm.exception())
return {};