summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-09 21:24:07 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-09 23:46:45 +0100
commit1f995381850e422943f0fcf045d9b9faeb2e06de (patch)
treeff1c98255d9ee0caac6ae236b5a43c550b79f2c1 /Userland/Libraries/LibJS/Runtime
parent4be2aeca00f36929aad141935eae68439835b76c (diff)
downloadserenity-1f995381850e422943f0fcf045d9b9faeb2e06de.zip
LibJS: Make Temporal foo_from_fields() AO field/options Object a const*
This is a bit of a lie as the Value(Object const*) ctor will const_cast them in invoke(), but at least it ensures that nothing else in the function relies on getting non-const Objects. Perhaps we can have an actual Object const* Value in the future as well.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp12
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h12
2 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index 51763c16f5..95c885384c 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -439,7 +439,7 @@ Object* get_temporal_calendar_with_iso_default(GlobalObject& global_object, Obje
}
// 12.1.24 DateFromFields ( calendar, fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-datefromfields
-PlainDate* date_from_fields(GlobalObject& global_object, Object& calendar, Object& fields, Object& options)
+PlainDate* date_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const& options)
{
auto& vm = global_object.vm();
@@ -465,7 +465,7 @@ PlainDate* date_from_fields(GlobalObject& global_object, Object& calendar, Objec
}
// 12.1.25 YearMonthFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-yearmonthfromfields
-PlainYearMonth* year_month_from_fields(GlobalObject& global_object, Object& calendar, Object& fields, Object* options)
+PlainYearMonth* year_month_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options)
{
auto& vm = global_object.vm();
@@ -495,7 +495,7 @@ PlainYearMonth* year_month_from_fields(GlobalObject& global_object, Object& cale
}
// 12.1.26 MonthDayFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-monthdayfromfields
-PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calendar, Object& fields, Object* options)
+PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options)
{
auto& vm = global_object.vm();
@@ -793,7 +793,7 @@ double resolve_iso_month(GlobalObject& global_object, Object& fields)
}
// 12.1.38 ISODateFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields
-Optional<ISODate> iso_date_from_fields(GlobalObject& global_object, Object& fields, Object& options)
+Optional<ISODate> iso_date_from_fields(GlobalObject& global_object, Object const& fields, Object const& options)
{
auto& vm = global_object.vm();
@@ -841,7 +841,7 @@ Optional<ISODate> iso_date_from_fields(GlobalObject& global_object, Object& fiel
}
// 12.1.39 ISOYearMonthFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
-Optional<ISOYearMonth> iso_year_month_from_fields(GlobalObject& global_object, Object& fields, Object& options)
+Optional<ISOYearMonth> iso_year_month_from_fields(GlobalObject& global_object, Object const& fields, Object const& options)
{
auto& vm = global_object.vm();
@@ -883,7 +883,7 @@ Optional<ISOYearMonth> iso_year_month_from_fields(GlobalObject& global_object, O
}
// 12.1.40 ISOMonthDayFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields
-Optional<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_object, Object& fields, Object& options)
+Optional<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_object, Object const& fields, Object const& options)
{
auto& vm = global_object.vm();
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
index 6b1763384e..d2ed6df29a 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
@@ -51,9 +51,9 @@ Value calendar_era_year(GlobalObject&, Object& calendar, Object& date_like);
Object* to_temporal_calendar(GlobalObject&, Value);
Object* to_temporal_calendar_with_iso_default(GlobalObject&, Value);
Object* get_temporal_calendar_with_iso_default(GlobalObject&, Object&);
-PlainDate* date_from_fields(GlobalObject&, Object& calendar, Object& fields, Object& options);
-PlainYearMonth* year_month_from_fields(GlobalObject&, Object& calendar, Object& fields, Object* options = nullptr);
-PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calendar, Object& fields, Object* options = nullptr);
+PlainDate* date_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const& options);
+PlainYearMonth* year_month_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr);
+PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options = nullptr);
String format_calendar_annotation(StringView id, StringView show_calendar);
bool calendar_equals(GlobalObject&, Object& one, Object& two);
Object* consolidate_calendars(GlobalObject&, Object& one, Object& two);
@@ -65,9 +65,9 @@ u16 to_iso_day_of_year(i32 year, u8 month, u8 day);
u8 to_iso_week_of_year(i32 year, u8 month, u8 day);
String build_iso_month_code(u8 month);
double resolve_iso_month(GlobalObject&, Object& fields);
-Optional<ISODate> iso_date_from_fields(GlobalObject&, Object& fields, Object& options);
-Optional<ISOYearMonth> iso_year_month_from_fields(GlobalObject&, Object& fields, Object& options);
-Optional<ISOMonthDay> iso_month_day_from_fields(GlobalObject&, Object& fields, Object& options);
+Optional<ISODate> iso_date_from_fields(GlobalObject&, Object const& fields, Object const& options);
+Optional<ISOYearMonth> iso_year_month_from_fields(GlobalObject&, Object const& fields, Object const& options);
+Optional<ISOMonthDay> iso_month_day_from_fields(GlobalObject&, Object const& fields, Object const& options);
i32 iso_year(Object& temporal_object);
u8 iso_month(Object& temporal_object);
String iso_month_code(Object& temporal_object);