summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-06-18 13:36:19 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-18 13:54:46 +0100
commit0c3d2b656e3b35cbcc12c5218fac0fcfc8184137 (patch)
tree32023a57b4e60db569e93874fab1cc5b64140c6f /Userland/Libraries
parente6858964037488ee05d49f6a1d61089ab28e0440 (diff)
downloadserenity-0c3d2b656e3b35cbcc12c5218fac0fcfc8184137.zip
LibJS: Rename CalendarMergeFieldNames to MergeLists
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/bebf467
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp28
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp4
4 files changed, 19 insertions, 19 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index 190293972b..24baa84d9d 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -997,27 +997,27 @@ ThrowCompletionOr<Object*> default_merge_calendar_fields(GlobalObject& global_ob
return merged;
}
-// 12.2.41 CalendarMergeFieldNames ( receiverFieldNames, inputFieldNames ), https://tc39.es/proposal-temporal/#sec-temporal-calendarmergefieldnames
-Vector<String> calendar_merge_field_names(Vector<String> const& receiver_field_names, Vector<String> const& input_field_names)
+// 12.2.41 MergeLists ( a, b ), https://tc39.es/proposal-temporal/#sec-temporal-mergelists
+Vector<String> merge_lists(Vector<String> const& a, Vector<String> const& b)
{
// 1. Let merged be a new empty List.
Vector<String> merged;
- // 2. For each element name of receiverFieldNames, do
- for (auto const& field_name : receiver_field_names) {
- // a. If merged does not contain name, then
- if (!merged.contains_slow(field_name)) {
- // i. Append name to merged.
- merged.append(field_name);
+ // 2. For each element element of a, do
+ for (auto const& element : a) {
+ // a. If merged does not contain element, then
+ if (!merged.contains_slow(element)) {
+ // i. Append element to merged.
+ merged.append(element);
}
}
- // 3. For each element name of inputFieldNames, do
- for (auto const& field_name : input_field_names) {
- // a. If merged does not contain name, then
- if (!merged.contains_slow(field_name)) {
- // i. Append name to merged.
- merged.append(field_name);
+ // 3. For each element element of b, do
+ for (auto const& element : b) {
+ // a. If merged does not contain element, then
+ if (!merged.contains_slow(element)) {
+ // i. Append element to merged.
+ merged.append(element);
}
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
index ae19d9e0e5..040a6a7e75 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
@@ -74,6 +74,6 @@ u8 iso_month(Object& temporal_object);
String iso_month_code(Object& temporal_object);
u8 iso_day(Object& temporal_object);
ThrowCompletionOr<Object*> default_merge_calendar_fields(GlobalObject&, Object const& fields, Object const& additional_fields);
-Vector<String> calendar_merge_field_names(Vector<String> const& receiver_field_names, Vector<String> const& input_field_names);
+Vector<String> merge_lists(Vector<String> const& a, Vector<String> const& b);
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp
index 5a7cbca33c..4413ce794b 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp
@@ -231,8 +231,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date)
// 9. Let mergedFields be ? CalendarMergeFields(calendar, fields, inputFields).
auto* merged_fields = TRY(calendar_merge_fields(global_object, calendar, *fields, *input_fields));
- // 10. Let mergedFieldNames be CalendarMergeFieldNames(receiverFieldNames, inputFieldNames).
- auto merged_field_names = calendar_merge_field_names(receiver_field_names, input_field_names);
+ // 10. Let mergedFieldNames be MergeLists(receiverFieldNames, inputFieldNames).
+ auto merged_field_names = merge_lists(receiver_field_names, input_field_names);
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, Vector<StringView> {}));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp
index 0dfadf15f3..68bea0ea69 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp
@@ -398,8 +398,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date)
// 9. Let mergedFields be ? CalendarMergeFields(calendar, fields, inputFields).
auto* merged_fields = TRY(calendar_merge_fields(global_object, calendar, *fields, *input_fields));
- // 10. Let mergedFieldNames be CalendarMergeFieldNames(receiverFieldNames, inputFieldNames).
- auto merged_field_names = calendar_merge_field_names(receiver_field_names, input_field_names);
+ // 10. Let mergedFieldNames be MergeLists(receiverFieldNames, inputFieldNames).
+ auto merged_field_names = merge_lists(receiver_field_names, input_field_names);
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, Vector<StringView> {}));