diff options
author | Linus Groh <mail@linusgroh.de> | 2021-09-01 00:31:22 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-01 15:11:35 +0100 |
commit | f169ad61a4e71e7160564a4b6bad04c4dc431389 (patch) | |
tree | 36616045890119b035cf2fb592d44d1eaa2dce8e | |
parent | ed98c1afc7840e243345e4457f7641e3be552185 (diff) | |
download | serenity-f169ad61a4e71e7160564a4b6bad04c4dc431389.zip |
LibJS: Make 'options' argument of Calendar prototype functions optional
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/9cc913e
5 files changed, 16 insertions, 16 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index d80804d601..66023661ec 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -36,10 +36,10 @@ void CalendarPrototype::initialize(GlobalObject& global_object) define_native_accessor(vm.names.id, id_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.dateFromFields, date_from_fields, 2, attr); - define_native_function(vm.names.yearMonthFromFields, year_month_from_fields, 2, attr); - define_native_function(vm.names.monthDayFromFields, month_day_from_fields, 2, attr); - define_native_function(vm.names.dateAdd, date_add, 3, attr); + define_native_function(vm.names.dateFromFields, date_from_fields, 1, attr); + define_native_function(vm.names.yearMonthFromFields, year_month_from_fields, 1, attr); + define_native_function(vm.names.monthDayFromFields, month_day_from_fields, 1, attr); + define_native_function(vm.names.dateAdd, date_add, 2, attr); define_native_function(vm.names.year, year, 1, attr); define_native_function(vm.names.month, month, 1, attr); define_native_function(vm.names.monthCode, month_code, 1, attr); @@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::id_getter) return js_string(vm, calendar.to_string(global_object)); } -// 12.4.4 Temporal.Calendar.prototype.dateFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.datefromfields +// 12.4.4 Temporal.Calendar.prototype.dateFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.datefromfields // NOTE: This is the minimum dateFromFields implementation for engines without ECMA-402. JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields) { @@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields) return create_temporal_date(global_object, result->year, result->month, result->day, *calendar); } -// 12.4.5 Temporal.Calendar.prototype.yearMonthFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields +// 12.4.5 Temporal.Calendar.prototype.yearMonthFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields // NOTE: This is the minimum yearMonthFromFields implementation for engines without ECMA-402. JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields) { @@ -151,7 +151,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields) return create_temporal_year_month(global_object, result->year, result->month, *calendar, result->reference_iso_day); } -// 12.4.6 Temporal.Calendar.prototype.monthDayFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.monthdayfromfields +// 12.4.6 Temporal.Calendar.prototype.monthDayFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.monthdayfromfields // NOTE: This is the minimum monthDayFromFields implementation for engines without ECMA-402. JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields) { @@ -185,7 +185,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields) return create_temporal_month_day(global_object, result->month, result->day, *calendar, result->reference_iso_year); } -// 12.4.7 Temporal.Calendar.prototype.dateAdd ( date, duration, options ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateadd +// 12.4.7 Temporal.Calendar.prototype.dateAdd ( date, duration [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateadd // NOTE: This is the minimum dateAdd implementation for engines without ECMA-402. JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_add) { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateAdd.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateAdd.js index dcdb1f36a4..f01775a492 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateAdd.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateAdd.js @@ -1,6 +1,6 @@ describe("correct behavior", () => { - test("length is 3", () => { - expect(Temporal.Calendar.prototype.dateAdd).toHaveLength(3); + test("length is 2", () => { + expect(Temporal.Calendar.prototype.dateAdd).toHaveLength(2); }); test("basic functionality", () => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateFromFields.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateFromFields.js index 552518d014..5485af1c74 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateFromFields.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.dateFromFields.js @@ -1,6 +1,6 @@ describe("correct behavior", () => { - test("length is 2", () => { - expect(Temporal.Calendar.prototype.dateFromFields).toHaveLength(2); + test("length is 1", () => { + expect(Temporal.Calendar.prototype.dateFromFields).toHaveLength(1); }); test("basic functionality", () => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.monthDayFromFields.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.monthDayFromFields.js index 6d55420c28..f1a62165a8 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.monthDayFromFields.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.monthDayFromFields.js @@ -1,6 +1,6 @@ describe("correct behavior", () => { - test("length is 2", () => { - expect(Temporal.Calendar.prototype.monthDayFromFields).toHaveLength(2); + test("length is 1", () => { + expect(Temporal.Calendar.prototype.monthDayFromFields).toHaveLength(1); }); test("basic functionality", () => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.yearMonthFromFields.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.yearMonthFromFields.js index 058a137cd7..83630a7bac 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.yearMonthFromFields.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Calendar/Calendar.prototype.yearMonthFromFields.js @@ -1,6 +1,6 @@ describe("correct behavior", () => { - test("length is 2", () => { - expect(Temporal.Calendar.prototype.yearMonthFromFields).toHaveLength(2); + test("length is 1", () => { + expect(Temporal.Calendar.prototype.yearMonthFromFields).toHaveLength(1); }); test("basic functionality", () => { |