summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-06-14 23:58:25 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-15 17:49:20 +0100
commitfafc9b07c4c7a8cc83a9eff1dfaed30dac597bb0 (patch)
tree76eb4edd0337918762ea39a18a94d30214260fc1 /Userland
parentbe2c86002a930a3b83c016f6dd873517a9e4e0b6 (diff)
downloadserenity-fafc9b07c4c7a8cc83a9eff1dfaed30dac597bb0.zip
LibJS: Mark AO calls creating a copy of built-in objects as infallible
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/536f067
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp4
6 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
index 2fab1eefbd..d1534bd27a 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
@@ -94,8 +94,8 @@ JS_DEFINE_NATIVE_FUNCTION(DurationConstructor::from)
if (item.is_object() && is<Duration>(item.as_object())) {
auto& duration = static_cast<Duration&>(item.as_object());
- // a. Return ? CreateTemporalDuration(item.[[Years]], item.[[Months]], item.[[Weeks]], item.[[Days]], item.[[Hours]], item.[[Minutes]], item.[[Seconds]], item.[[Milliseconds]], item.[[Microseconds]], item.[[Nanoseconds]]).
- return TRY(create_temporal_duration(global_object, duration.years(), duration.months(), duration.weeks(), duration.days(), duration.hours(), duration.minutes(), duration.seconds(), duration.milliseconds(), duration.microseconds(), duration.nanoseconds()));
+ // a. Return ! CreateTemporalDuration(item.[[Years]], item.[[Months]], item.[[Weeks]], item.[[Days]], item.[[Hours]], item.[[Minutes]], item.[[Seconds]], item.[[Milliseconds]], item.[[Microseconds]], item.[[Nanoseconds]]).
+ return MUST(create_temporal_duration(global_object, duration.years(), duration.months(), duration.weeks(), duration.days(), duration.hours(), duration.minutes(), duration.seconds(), duration.milliseconds(), duration.microseconds(), duration.nanoseconds()));
}
// 2. Return ? ToTemporalDuration(item).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
index 704b0874a1..1f5ca65149 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
@@ -86,8 +86,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateConstructor::from)
// a. Perform ? ToTemporalOverflow(options).
(void)TRY(to_temporal_overflow(global_object, options));
- // b. Return ? CreateTemporalDate(item.[[ISOYear]], item.[[ISOMonth]], item.[[ISODay]], item.[[Calendar]]).
- return TRY(create_temporal_date(global_object, plain_date_item.iso_year(), plain_date_item.iso_month(), plain_date_item.iso_day(), plain_date_item.calendar()));
+ // b. Return ! CreateTemporalDate(item.[[ISOYear]], item.[[ISOMonth]], item.[[ISODay]], item.[[Calendar]]).
+ return MUST(create_temporal_date(global_object, plain_date_item.iso_year(), plain_date_item.iso_month(), plain_date_item.iso_day(), plain_date_item.calendar()));
}
// 3. Return ? ToTemporalDate(item, options).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
index 22675e3117..0eb904b404 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
@@ -107,8 +107,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimeConstructor::from)
// a. Perform ? ToTemporalOverflow(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(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()));
+ // b. Return ! CreateTemporalDateTime(item.[[ISOYear]], item.[[ISOMonth]], item.[[ISODay]], item.[[ISOHour]], item.[[ISOMinute]], item.[[ISOSecond]], item.[[ISOMillisecond]], item.[[ISOMicrosecond]], item.[[ISONanosecond]], item.[[Calendar]]).
+ return MUST(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).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp
index 111d534795..dc2501246a 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp
@@ -97,8 +97,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayConstructor::from)
auto& plain_month_day_object = static_cast<PlainMonthDay&>(item.as_object());
- // b. Return ? CreateTemporalMonthDay(item.[[ISOMonth]], item.[[ISODay]], item.[[Calendar]], item.[[ISOYear]]).
- return TRY(create_temporal_month_day(global_object, plain_month_day_object.iso_month(), plain_month_day_object.iso_day(), plain_month_day_object.calendar(), plain_month_day_object.iso_year()));
+ // b. Return ! CreateTemporalMonthDay(item.[[ISOMonth]], item.[[ISODay]], item.[[Calendar]], item.[[ISOYear]]).
+ return MUST(create_temporal_month_day(global_object, plain_month_day_object.iso_month(), plain_month_day_object.iso_day(), plain_month_day_object.calendar(), plain_month_day_object.iso_year()));
}
// 3. Return ? ToTemporalMonthDay(item, options).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp
index 229513a3f0..d98c8c0eb1 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp
@@ -92,8 +92,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimeConstructor::from)
// 3. If Type(item) is Object and item has an [[InitializedTemporalTime]] internal slot, then
if (item.is_object() && is<PlainTime>(item.as_object())) {
auto& plain_time = static_cast<PlainTime&>(item.as_object());
- // a. Return ? CreateTemporalTime(item.[[ISOHour]], item.[[ISOMinute]], item.[[ISOSecond]], item.[[ISOMillisecond]], item.[[ISOMicrosecond]], item.[[ISONanosecond]]).
- return TRY(create_temporal_time(global_object, plain_time.iso_hour(), plain_time.iso_minute(), plain_time.iso_second(), plain_time.iso_millisecond(), plain_time.iso_microsecond(), plain_time.iso_nanosecond()));
+ // a. Return ! CreateTemporalTime(item.[[ISOHour]], item.[[ISOMinute]], item.[[ISOSecond]], item.[[ISOMillisecond]], item.[[ISOMicrosecond]], item.[[ISONanosecond]]).
+ return MUST(create_temporal_time(global_object, plain_time.iso_hour(), plain_time.iso_minute(), plain_time.iso_second(), plain_time.iso_millisecond(), plain_time.iso_microsecond(), plain_time.iso_nanosecond()));
}
// 4. Return ? ToTemporalTime(item, overflow).
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp
index 49fc644549..930b749079 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp
@@ -99,8 +99,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthConstructor::from)
auto& plain_year_month_object = static_cast<PlainYearMonth&>(item.as_object());
- // b. Return ? CreateTemporalYearMonth(item.[[ISOYear]], item.[[ISOMonth]], item.[[Calendar]], item.[[ISODay]]).
- return TRY(create_temporal_year_month(global_object, plain_year_month_object.iso_year(), plain_year_month_object.iso_month(), plain_year_month_object.calendar(), plain_year_month_object.iso_day()));
+ // b. Return ! CreateTemporalYearMonth(item.[[ISOYear]], item.[[ISOMonth]], item.[[Calendar]], item.[[ISODay]]).
+ return MUST(create_temporal_year_month(global_object, plain_year_month_object.iso_year(), plain_year_month_object.iso_month(), plain_year_month_object.calendar(), plain_year_month_object.iso_day()));
}
// 3. Return ? ToTemporalYearMonth(item, options).