mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +00:00
LibJS: Follow rules for consuming completion records
This is an editorial change in the Temporal spec.
See: 1c19b96
This commit is contained in:
parent
2bae040bc9
commit
68af8649fb
21 changed files with 78 additions and 78 deletions
|
@ -84,7 +84,7 @@ ThrowCompletionOr<Object*> get_options_object(GlobalObject& global_object, Value
|
||||||
|
|
||||||
// 1. If options is undefined, then
|
// 1. If options is undefined, then
|
||||||
if (options.is_undefined()) {
|
if (options.is_undefined()) {
|
||||||
// a. Return ! OrdinaryObjectCreate(null).
|
// a. Return OrdinaryObjectCreate(null).
|
||||||
return Object::create(global_object, nullptr);
|
return Object::create(global_object, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o
|
||||||
|
|
||||||
// 7. If type is Boolean, then
|
// 7. If type is Boolean, then
|
||||||
if (type == OptionType::Boolean) {
|
if (type == OptionType::Boolean) {
|
||||||
// a. Set value to ! ToBoolean(value).
|
// a. Set value to ToBoolean(value).
|
||||||
value = Value(value.to_boolean());
|
value = Value(value.to_boolean());
|
||||||
}
|
}
|
||||||
// 8. Else if type is Number, then
|
// 8. Else if type is Number, then
|
||||||
|
@ -617,7 +617,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(GlobalObject& global_object
|
||||||
// e. Let fields be ? PrepareTemporalFields(value, fieldNames, «»).
|
// e. Let fields be ? PrepareTemporalFields(value, fieldNames, «»).
|
||||||
auto* fields = TRY(prepare_temporal_fields(global_object, value_object, field_names, {}));
|
auto* fields = TRY(prepare_temporal_fields(global_object, value_object, field_names, {}));
|
||||||
|
|
||||||
// f. Let dateOptions be ! OrdinaryObjectCreate(null).
|
// f. Let dateOptions be OrdinaryObjectCreate(null).
|
||||||
auto* date_options = Object::create(global_object, nullptr);
|
auto* date_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// g. Perform ! CreateDataPropertyOrThrow(dateOptions, "overflow", "constrain").
|
// g. Perform ! CreateDataPropertyOrThrow(dateOptions, "overflow", "constrain").
|
||||||
|
@ -666,7 +666,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(GlobalObject& global_object
|
||||||
|
|
||||||
// f. If timeZoneName is not undefined, then
|
// f. If timeZoneName is not undefined, then
|
||||||
if (time_zone_name.has_value()) {
|
if (time_zone_name.has_value()) {
|
||||||
// i. If ParseText(! StringToCodePoints(timeZoneName), TimeZoneNumericUTCOffset) is not a List of errors, then
|
// i. If ParseText(StringToCodePoints(timeZoneName), TimeZoneNumericUTCOffset) is not a List of errors, then
|
||||||
// FIXME: Logic error in the spec (check for no errors -> check for errors).
|
// FIXME: Logic error in the spec (check for no errors -> check for errors).
|
||||||
// See: https://github.com/tc39/proposal-temporal/pull/2000
|
// See: https://github.com/tc39/proposal-temporal/pull/2000
|
||||||
if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) {
|
if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) {
|
||||||
|
@ -828,7 +828,7 @@ ThrowCompletionOr<Object*> merge_largest_unit_option(GlobalObject& global_object
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. Let merged be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 1. Let merged be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* merged = Object::create(global_object, global_object.object_prototype());
|
auto* merged = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 2. Let keys be ? EnumerableOwnPropertyNames(options, key).
|
// 2. Let keys be ? EnumerableOwnPropertyNames(options, key).
|
||||||
|
@ -1113,7 +1113,7 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(GlobalObject& global_object,
|
||||||
else
|
else
|
||||||
normalized_year = year_part.value_or("0");
|
normalized_year = year_part.value_or("0");
|
||||||
|
|
||||||
// 7. If ! SameValue(year, "-000000") is true, throw a RangeError exception.
|
// 7. If SameValue(year, "-000000") is true, throw a RangeError exception.
|
||||||
if (normalized_year == "-000000"sv)
|
if (normalized_year == "-000000"sv)
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidExtendedYearNegativeZero);
|
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidExtendedYearNegativeZero);
|
||||||
|
|
||||||
|
@ -1345,7 +1345,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g
|
||||||
|
|
||||||
// 1. Assert: Type(isoString) is String.
|
// 1. Assert: Type(isoString) is String.
|
||||||
|
|
||||||
// 2. Let duration be ParseText(! StringToCodePoints(isoString), TemporalDurationString).
|
// 2. Let duration be ParseText(StringToCodePoints(isoString), TemporalDurationString).
|
||||||
auto parse_result = parse_iso8601(Production::TemporalDurationString, iso_string);
|
auto parse_result = parse_iso8601(Production::TemporalDurationString, iso_string);
|
||||||
|
|
||||||
// 3. If duration is a List of errors, throw a RangeError exception.
|
// 3. If duration is a List of errors, throw a RangeError exception.
|
||||||
|
@ -1390,7 +1390,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g
|
||||||
if (minutes_part.has_value() || f_minutes_part.has_value() || seconds_part.has_value() || f_seconds_part.has_value())
|
if (minutes_part.has_value() || f_minutes_part.has_value() || seconds_part.has_value() || f_seconds_part.has_value())
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "hours"sv, "minutes or seconds"sv);
|
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "hours"sv, "minutes or seconds"sv);
|
||||||
|
|
||||||
// b. Let fHoursDigits be the substring of ! CodePointsToString(fHours) from 1.
|
// b. Let fHoursDigits be the substring of CodePointsToString(fHours) from 1.
|
||||||
auto f_hours_digits = f_hours_part->substring_view(1);
|
auto f_hours_digits = f_hours_part->substring_view(1);
|
||||||
|
|
||||||
// c. Let fHoursScale be the length of fHoursDigits.
|
// c. Let fHoursScale be the length of fHoursDigits.
|
||||||
|
@ -1413,7 +1413,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g
|
||||||
if (seconds_part.has_value() || f_seconds_part.has_value())
|
if (seconds_part.has_value() || f_seconds_part.has_value())
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "minutes"sv, "seconds"sv);
|
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "minutes"sv, "seconds"sv);
|
||||||
|
|
||||||
// b. Let fMinutesDigits be the substring of ! CodePointsToString(fMinutes) from 1.
|
// b. Let fMinutesDigits be the substring of CodePointsToString(fMinutes) from 1.
|
||||||
auto f_minutes_digits = f_minutes_part->substring_view(1);
|
auto f_minutes_digits = f_minutes_part->substring_view(1);
|
||||||
|
|
||||||
// c. Let fMinutesScale be the length of fMinutesDigits.
|
// c. Let fMinutesScale be the length of fMinutesDigits.
|
||||||
|
@ -1437,7 +1437,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g
|
||||||
|
|
||||||
// 15. If fSeconds is not empty, then
|
// 15. If fSeconds is not empty, then
|
||||||
if (f_seconds_part.has_value()) {
|
if (f_seconds_part.has_value()) {
|
||||||
// a. Let fSecondsDigits be the substring of ! CodePointsToString(fSeconds) from 1.
|
// a. Let fSecondsDigits be the substring of CodePointsToString(fSeconds) from 1.
|
||||||
auto f_seconds_digits = f_seconds_part->substring_view(1);
|
auto f_seconds_digits = f_seconds_part->substring_view(1);
|
||||||
|
|
||||||
// b. Let fSecondsScale be the length of fSecondsDigits.
|
// b. Let fSecondsScale be the length of fSecondsDigits.
|
||||||
|
@ -1588,9 +1588,9 @@ ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_
|
||||||
// 4. Let result be ? ParseISODateTime(isoString).
|
// 4. Let result be ? ParseISODateTime(isoString).
|
||||||
auto result = TRY(parse_iso_date_time(global_object, *parse_result));
|
auto result = TRY(parse_iso_date_time(global_object, *parse_result));
|
||||||
|
|
||||||
// 5. Assert: ParseText(! StringToCodePoints(isoString), CalendarDate) is a List of errors.
|
// 5. Assert: ParseText(StringToCodePoints(isoString), CalendarDate) is a List of errors.
|
||||||
// 6. Assert: ParseText(! StringToCodePoints(isoString), DateSpecYearMonth) is a List of errors.
|
// 6. Assert: ParseText(StringToCodePoints(isoString), DateSpecYearMonth) is a List of errors.
|
||||||
// 7. Assert: ParseText(! StringToCodePoints(isoString), DateSpecMonthDay) is a List of errors.
|
// 7. Assert: ParseText(StringToCodePoints(isoString), DateSpecMonthDay) is a List of errors.
|
||||||
|
|
||||||
// 8. Return the Record { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }.
|
// 8. Return the Record { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }.
|
||||||
return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) };
|
return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) };
|
||||||
|
@ -1603,7 +1603,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject
|
||||||
|
|
||||||
// 1. Assert: Type(isoString) is String.
|
// 1. Assert: Type(isoString) is String.
|
||||||
|
|
||||||
// 2. Let parseResult be ParseText(! StringToCodePoints(isoString), TemporalTimeZoneString).
|
// 2. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalTimeZoneString).
|
||||||
auto parse_result = parse_iso8601(Production::TemporalTimeZoneString, iso_string);
|
auto parse_result = parse_iso8601(Production::TemporalTimeZoneString, iso_string);
|
||||||
|
|
||||||
// 3. If parseResult is a List of errors, then
|
// 3. If parseResult is a List of errors, then
|
||||||
|
@ -1620,7 +1620,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject
|
||||||
// 5. If name is empty, then
|
// 5. If name is empty, then
|
||||||
// a. Set name to undefined.
|
// a. Set name to undefined.
|
||||||
// 6. Else,
|
// 6. Else,
|
||||||
// a. Set name to ! CodePointsToString(name).
|
// a. Set name to CodePointsToString(name).
|
||||||
// NOTE: No-op.
|
// NOTE: No-op.
|
||||||
|
|
||||||
// 7. If z is not empty, then
|
// 7. If z is not empty, then
|
||||||
|
@ -1632,7 +1632,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject
|
||||||
// 8. If offsetString is empty, then
|
// 8. If offsetString is empty, then
|
||||||
// a. Set offsetString to undefined.
|
// a. Set offsetString to undefined.
|
||||||
// 9. Else,
|
// 9. Else,
|
||||||
// a. Set offsetString to ! CodePointsToString(offsetString).
|
// a. Set offsetString to CodePointsToString(offsetString).
|
||||||
// NOTE: No-op.
|
// NOTE: No-op.
|
||||||
|
|
||||||
// 10. Return the Record { [[Z]]: false, [[OffsetString]]: offsetString, [[Name]]: name }.
|
// 10. Return the Record { [[Z]]: false, [[OffsetString]]: offsetString, [[Name]]: name }.
|
||||||
|
@ -1691,7 +1691,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object,
|
||||||
|
|
||||||
// 1. Assert: Type(fields) is Object.
|
// 1. Assert: Type(fields) is Object.
|
||||||
|
|
||||||
// 2. Let result be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 2. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* result = Object::create(global_object, global_object.object_prototype());
|
auto* result = Object::create(global_object, global_object.object_prototype());
|
||||||
VERIFY(result);
|
VERIFY(result);
|
||||||
|
|
||||||
|
@ -1742,7 +1742,7 @@ ThrowCompletionOr<Object*> prepare_partial_temporal_fields(GlobalObject& global_
|
||||||
|
|
||||||
// 1. Assert: Type(fields) is Object.
|
// 1. Assert: Type(fields) is Object.
|
||||||
|
|
||||||
// 2. Let result be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 2. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* result = Object::create(global_object, global_object.object_prototype());
|
auto* result = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 3. Let any be false.
|
// 3. Let any be false.
|
||||||
|
|
|
@ -176,7 +176,7 @@ ThrowCompletionOr<double> to_integer_without_rounding(GlobalObject& global_objec
|
||||||
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
|
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// 3. If ! IsIntegralNumber(number) is false, throw a RangeError exception.
|
// 3. If IsIntegralNumber(number) is false, throw a RangeError exception.
|
||||||
if (!number.is_integral_number())
|
if (!number.is_integral_number())
|
||||||
return vm.template throw_completion<RangeError>(global_object, error_type, args...);
|
return vm.template throw_completion<RangeError>(global_object, error_type, args...);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +88,7 @@ ThrowCompletionOr<Vector<String>> calendar_fields(GlobalObject& global_object, O
|
||||||
// 1. Let fields be ? GetMethod(calendar, "fields").
|
// 1. Let fields be ? GetMethod(calendar, "fields").
|
||||||
auto fields = TRY(Value(&calendar).get_method(global_object, vm.names.fields));
|
auto fields = TRY(Value(&calendar).get_method(global_object, vm.names.fields));
|
||||||
|
|
||||||
// 2. Let fieldsArray be ! CreateArrayFromList(fieldNames).
|
// 2. Let fieldsArray be CreateArrayFromList(fieldNames).
|
||||||
auto field_names_values = MarkedVector<Value> { vm.heap() };
|
auto field_names_values = MarkedVector<Value> { vm.heap() };
|
||||||
for (auto& field_name : field_names)
|
for (auto& field_name : field_names)
|
||||||
field_names_values.append(js_string(vm, field_name));
|
field_names_values.append(js_string(vm, field_name));
|
||||||
|
@ -774,7 +774,7 @@ ThrowCompletionOr<double> resolve_iso_month(GlobalObject& global_object, Object
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode);
|
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 11. If ! SameValueNonNumeric(monthCode, ! BuildISOMonthCode(numberPart)) is false, then
|
// 11. If SameValueNonNumeric(monthCode, ! BuildISOMonthCode(numberPart)) is false, then
|
||||||
if (month_code_string != build_iso_month_code(number_part_integer)) {
|
if (month_code_string != build_iso_month_code(number_part_integer)) {
|
||||||
// a. Throw a RangeError exception.
|
// a. Throw a RangeError exception.
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode);
|
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode);
|
||||||
|
@ -983,7 +983,7 @@ ThrowCompletionOr<Object*> default_merge_fields(GlobalObject& global_object, Obj
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. Let merged be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 1. Let merged be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* merged = Object::create(global_object, global_object.object_prototype());
|
auto* merged = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 2. Let originalKeys be ? EnumerableOwnPropertyNames(fields, key).
|
// 2. Let originalKeys be ? EnumerableOwnPropertyNames(fields, key).
|
||||||
|
|
|
@ -535,7 +535,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields)
|
||||||
field_names.append(next_value);
|
field_names.append(next_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8. Return ! CreateArrayFromList(fieldNames).
|
// 8. Return CreateArrayFromList(fieldNames).
|
||||||
return Array::create_from(global_object, field_names);
|
return Array::create_from(global_object, field_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -630,13 +630,13 @@ ThrowCompletionOr<DateDurationRecord> unbalance_duration_relative(GlobalObject&
|
||||||
|
|
||||||
// d. Repeat, while years ≠ 0,
|
// d. Repeat, while years ≠ 0,
|
||||||
while (years != 0) {
|
while (years != 0) {
|
||||||
// i. Let addOptions be ! OrdinaryObjectCreate(null).
|
// i. Let addOptions be OrdinaryObjectCreate(null).
|
||||||
auto* add_options = Object::create(global_object, nullptr);
|
auto* add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// ii. Let newRelativeTo be ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
// ii. Let newRelativeTo be ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
||||||
auto* new_relative_to = TRY(calendar_date_add(global_object, *calendar, relative_to, *one_year, add_options, date_add));
|
auto* new_relative_to = TRY(calendar_date_add(global_object, *calendar, relative_to, *one_year, add_options, date_add));
|
||||||
|
|
||||||
// iii. Let untilOptions be ! OrdinaryObjectCreate(null).
|
// iii. Let untilOptions be OrdinaryObjectCreate(null).
|
||||||
auto* until_options = Object::create(global_object, nullptr);
|
auto* until_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// iv. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
// iv. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
||||||
|
@ -851,7 +851,7 @@ ThrowCompletionOr<DateDurationRecord> balance_duration_relative(GlobalObject& gl
|
||||||
// i. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
// i. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
||||||
auto* date_add = TRY(Value(&calendar).get_method(global_object, vm.names.dateAdd));
|
auto* date_add = TRY(Value(&calendar).get_method(global_object, vm.names.dateAdd));
|
||||||
|
|
||||||
// j. Let addOptions be ! OrdinaryObjectCreate(null).
|
// j. Let addOptions be OrdinaryObjectCreate(null).
|
||||||
auto* add_options = Object::create(global_object, nullptr);
|
auto* add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// k. Let newRelativeTo be ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
// k. Let newRelativeTo be ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
||||||
|
@ -860,7 +860,7 @@ ThrowCompletionOr<DateDurationRecord> balance_duration_relative(GlobalObject& gl
|
||||||
// l. Let dateUntil be ? GetMethod(calendar, "dateUntil").
|
// l. Let dateUntil be ? GetMethod(calendar, "dateUntil").
|
||||||
auto* date_until = TRY(Value(&calendar).get_method(global_object, vm.names.dateUntil));
|
auto* date_until = TRY(Value(&calendar).get_method(global_object, vm.names.dateUntil));
|
||||||
|
|
||||||
// m. Let untilOptions be ! OrdinaryObjectCreate(null).
|
// m. Let untilOptions be OrdinaryObjectCreate(null).
|
||||||
auto* until_options = Object::create(global_object, nullptr);
|
auto* until_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// n. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
// n. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
||||||
|
@ -883,13 +883,13 @@ ThrowCompletionOr<DateDurationRecord> balance_duration_relative(GlobalObject& gl
|
||||||
// iii. Set relativeTo to newRelativeTo.
|
// iii. Set relativeTo to newRelativeTo.
|
||||||
relative_to = new_relative_to;
|
relative_to = new_relative_to;
|
||||||
|
|
||||||
// iv. Set addOptions to ! OrdinaryObjectCreate(null).
|
// iv. Set addOptions to OrdinaryObjectCreate(null).
|
||||||
add_options = Object::create(global_object, nullptr);
|
add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// v. Set newRelativeTo to ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
// v. Set newRelativeTo to ? CalendarDateAdd(calendar, relativeTo, oneYear, addOptions, dateAdd).
|
||||||
new_relative_to = TRY(calendar_date_add(global_object, calendar, relative_to, *one_year, add_options, date_add));
|
new_relative_to = TRY(calendar_date_add(global_object, calendar, relative_to, *one_year, add_options, date_add));
|
||||||
|
|
||||||
// vi. Set untilOptions to ! OrdinaryObjectCreate(null).
|
// vi. Set untilOptions to OrdinaryObjectCreate(null).
|
||||||
until_options = Object::create(global_object, nullptr);
|
until_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// vii. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
// vii. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "month").
|
||||||
|
@ -1017,13 +1017,13 @@ ThrowCompletionOr<DurationRecord> add_duration(GlobalObject& global_object, doub
|
||||||
// d. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
// d. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
||||||
auto* date_add = TRY(Value(&calendar).get_method(global_object, vm.names.dateAdd));
|
auto* date_add = TRY(Value(&calendar).get_method(global_object, vm.names.dateAdd));
|
||||||
|
|
||||||
// e. Let firstAddOptions be ! OrdinaryObjectCreate(null).
|
// e. Let firstAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* first_add_options = Object::create(global_object, nullptr);
|
auto* first_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// f. Let intermediate be ? CalendarDateAdd(calendar, relativeTo, dateDuration1, firstAddOptions, dateAdd).
|
// f. Let intermediate be ? CalendarDateAdd(calendar, relativeTo, dateDuration1, firstAddOptions, dateAdd).
|
||||||
auto* intermediate = TRY(calendar_date_add(global_object, calendar, &relative_to, *date_duration1, first_add_options, date_add));
|
auto* intermediate = TRY(calendar_date_add(global_object, calendar, &relative_to, *date_duration1, first_add_options, date_add));
|
||||||
|
|
||||||
// g. Let secondAddOptions be ! OrdinaryObjectCreate(null).
|
// g. Let secondAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* second_add_options = Object::create(global_object, nullptr);
|
auto* second_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// h. Let end be ? CalendarDateAdd(calendar, intermediate, dateDuration2, secondAddOptions, dateAdd).
|
// h. Let end be ? CalendarDateAdd(calendar, intermediate, dateDuration2, secondAddOptions, dateAdd).
|
||||||
|
@ -1032,7 +1032,7 @@ ThrowCompletionOr<DurationRecord> add_duration(GlobalObject& global_object, doub
|
||||||
// i. Let dateLargestUnit be ! LargerOfTwoTemporalUnits("day", largestUnit).
|
// i. Let dateLargestUnit be ! LargerOfTwoTemporalUnits("day", largestUnit).
|
||||||
auto date_largest_unit = larger_of_two_temporal_units("day"sv, largest_unit);
|
auto date_largest_unit = larger_of_two_temporal_units("day"sv, largest_unit);
|
||||||
|
|
||||||
// j. Let differenceOptions be ! OrdinaryObjectCreate(null).
|
// j. Let differenceOptions be OrdinaryObjectCreate(null).
|
||||||
auto* difference_options = Object::create(global_object, nullptr);
|
auto* difference_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// k. Perform ! CreateDataPropertyOrThrow(differenceOptions, "largestUnit", dateLargestUnit).
|
// k. Perform ! CreateDataPropertyOrThrow(differenceOptions, "largestUnit", dateLargestUnit).
|
||||||
|
@ -1084,7 +1084,7 @@ ThrowCompletionOr<DurationRecord> add_duration(GlobalObject& global_object, doub
|
||||||
// 7.5.23 MoveRelativeDate ( calendar, relativeTo, duration ), https://tc39.es/proposal-temporal/#sec-temporal-moverelativedate
|
// 7.5.23 MoveRelativeDate ( calendar, relativeTo, duration ), https://tc39.es/proposal-temporal/#sec-temporal-moverelativedate
|
||||||
ThrowCompletionOr<MoveRelativeDateResult> move_relative_date(GlobalObject& global_object, Object& calendar, PlainDate& relative_to, Duration& duration)
|
ThrowCompletionOr<MoveRelativeDateResult> move_relative_date(GlobalObject& global_object, Object& calendar, PlainDate& relative_to, Duration& duration)
|
||||||
{
|
{
|
||||||
// 1. Let options be ! OrdinaryObjectCreate(null).
|
// 1. Let options be OrdinaryObjectCreate(null).
|
||||||
auto* options = Object::create(global_object, nullptr);
|
auto* options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// 2. Let newDate be ? CalendarDateAdd(calendar, relativeTo, duration, options).
|
// 2. Let newDate be ? CalendarDateAdd(calendar, relativeTo, duration, options).
|
||||||
|
@ -1210,7 +1210,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// b. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
// b. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
||||||
auto* date_add = TRY(Value(calendar).get_method(global_object, vm.names.dateAdd));
|
auto* date_add = TRY(Value(calendar).get_method(global_object, vm.names.dateAdd));
|
||||||
|
|
||||||
// c. Let firstAddOptions be ! OrdinaryObjectCreate(null).
|
// c. Let firstAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* first_add_options = Object::create(global_object, nullptr);
|
auto* first_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// d. Let yearsLater be ? CalendarDateAdd(calendar, relativeTo, yearsDuration, firstAddOptions, dateAdd).
|
// d. Let yearsLater be ? CalendarDateAdd(calendar, relativeTo, yearsDuration, firstAddOptions, dateAdd).
|
||||||
|
@ -1219,7 +1219,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// e. Let yearsMonthsWeeks be ? CreateTemporalDuration(years, months, weeks, 0, 0, 0, 0, 0, 0, 0).
|
// e. Let yearsMonthsWeeks be ? CreateTemporalDuration(years, months, weeks, 0, 0, 0, 0, 0, 0, 0).
|
||||||
auto* years_months_weeks = TRY(create_temporal_duration(global_object, years, months, weeks, 0, 0, 0, 0, 0, 0, 0));
|
auto* years_months_weeks = TRY(create_temporal_duration(global_object, years, months, weeks, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// f. Let secondAddOptions be ! OrdinaryObjectCreate(null).
|
// f. Let secondAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* second_add_options = Object::create(global_object, nullptr);
|
auto* second_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// g. Let yearsMonthsWeeksLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, secondAddOptions, dateAdd).
|
// g. Let yearsMonthsWeeksLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, secondAddOptions, dateAdd).
|
||||||
|
@ -1237,13 +1237,13 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// k. Let daysDuration be ? CreateTemporalDuration(0, 0, 0, days, 0, 0, 0, 0, 0, 0).
|
// k. Let daysDuration be ? CreateTemporalDuration(0, 0, 0, days, 0, 0, 0, 0, 0, 0).
|
||||||
auto* days_duration = TRY(create_temporal_duration(global_object, 0, 0, 0, days, 0, 0, 0, 0, 0, 0));
|
auto* days_duration = TRY(create_temporal_duration(global_object, 0, 0, 0, days, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// l. Let thirdAddOptions be ! OrdinaryObjectCreate(null).
|
// l. Let thirdAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* third_add_options = Object::create(global_object, nullptr);
|
auto* third_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// m. Let daysLater be ? CalendarDateAdd(calendar, relativeTo, daysDuration, thirdAddOptions, dateAdd).
|
// m. Let daysLater be ? CalendarDateAdd(calendar, relativeTo, daysDuration, thirdAddOptions, dateAdd).
|
||||||
auto* days_later = TRY(calendar_date_add(global_object, *calendar, relative_to, *days_duration, third_add_options, date_add));
|
auto* days_later = TRY(calendar_date_add(global_object, *calendar, relative_to, *days_duration, third_add_options, date_add));
|
||||||
|
|
||||||
// n. Let untilOptions be ! OrdinaryObjectCreate(null).
|
// n. Let untilOptions be OrdinaryObjectCreate(null).
|
||||||
auto* until_options = Object::create(global_object, nullptr);
|
auto* until_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// o. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "year").
|
// o. Perform ! CreateDataPropertyOrThrow(untilOptions, "largestUnit", "year").
|
||||||
|
@ -1264,7 +1264,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// t. Let yearsDuration be ? CreateTemporalDuration(yearsPassed, 0, 0, 0, 0, 0, 0, 0, 0, 0).
|
// t. Let yearsDuration be ? CreateTemporalDuration(yearsPassed, 0, 0, 0, 0, 0, 0, 0, 0, 0).
|
||||||
years_duration = TRY(create_temporal_duration(global_object, years_passed, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
years_duration = TRY(create_temporal_duration(global_object, years_passed, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// u. Let fourthAddOptions be ! OrdinaryObjectCreate(null).
|
// u. Let fourthAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* fourth_add_options = Object::create(global_object, nullptr);
|
auto* fourth_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// v. Set relativeTo to ? CalendarDateAdd(calendar, relativeTo, yearsDuration, fourthAddOptions, dateAdd).
|
// v. Set relativeTo to ? CalendarDateAdd(calendar, relativeTo, yearsDuration, fourthAddOptions, dateAdd).
|
||||||
|
@ -1312,7 +1312,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// b. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
// b. Let dateAdd be ? GetMethod(calendar, "dateAdd").
|
||||||
auto* date_add = TRY(Value(calendar).get_method(global_object, vm.names.dateAdd));
|
auto* date_add = TRY(Value(calendar).get_method(global_object, vm.names.dateAdd));
|
||||||
|
|
||||||
// c. Let firstAddOptions be ! OrdinaryObjectCreate(null).
|
// c. Let firstAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* first_add_options = Object::create(global_object, nullptr);
|
auto* first_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// d. Let yearsMonthsLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonths, firstAddOptions, dateAdd).
|
// d. Let yearsMonthsLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonths, firstAddOptions, dateAdd).
|
||||||
|
@ -1321,7 +1321,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
||||||
// e. Let yearsMonthsWeeks be ? CreateTemporalDuration(years, months, weeks, 0, 0, 0, 0, 0, 0, 0).
|
// e. Let yearsMonthsWeeks be ? CreateTemporalDuration(years, months, weeks, 0, 0, 0, 0, 0, 0, 0).
|
||||||
auto* years_months_weeks = TRY(create_temporal_duration(global_object, years, months, weeks, 0, 0, 0, 0, 0, 0, 0));
|
auto* years_months_weeks = TRY(create_temporal_duration(global_object, years, months, weeks, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// f. Let secondAddOptions be ! OrdinaryObjectCreate(null).
|
// f. Let secondAddOptions be OrdinaryObjectCreate(null).
|
||||||
auto* seconds_add_options = Object::create(global_object, nullptr);
|
auto* seconds_add_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// g. Let yearsMonthsWeeksLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, secondAddOptions, dateAdd).
|
// g. Let yearsMonthsWeeksLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, secondAddOptions, dateAdd).
|
||||||
|
|
|
@ -356,7 +356,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be roundTo.
|
// a. Let paramString be roundTo.
|
||||||
|
|
||||||
// b. Set roundTo to ! OrdinaryObjectCreate(null).
|
// b. Set roundTo to OrdinaryObjectCreate(null).
|
||||||
round_to = Object::create(global_object, nullptr);
|
round_to = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
||||||
|
@ -477,7 +477,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::total)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be totalOf.
|
// a. Let paramString be totalOf.
|
||||||
|
|
||||||
// b. Set totalOf to ! OrdinaryObjectCreate(null).
|
// b. Set totalOf to OrdinaryObjectCreate(null).
|
||||||
total_of = Object::create(global_object, nullptr);
|
total_of = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(totalOf, "unit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(totalOf, "unit", paramString).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -262,7 +262,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::round)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be roundTo.
|
// a. Let paramString be roundTo.
|
||||||
|
|
||||||
// b. Set roundTo to ! OrdinaryObjectCreate(null).
|
// b. Set roundTo to OrdinaryObjectCreate(null).
|
||||||
round_to = Object::create(global_object, nullptr);
|
round_to = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
||||||
|
|
|
@ -73,7 +73,7 @@ ThrowCompletionOr<PlainDate*> to_temporal_date(GlobalObject& global_object, Valu
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
|
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
|
||||||
auto* temporal_date = TRY(typed_this_object(global_object));
|
auto* temporal_date = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", temporalDate.[[Calendar]]).
|
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", temporalDate.[[Calendar]]).
|
||||||
|
|
|
@ -57,13 +57,13 @@ BigInt* get_epoch_from_iso_parts(GlobalObject& global_object, i32 year, u8 month
|
||||||
// 3. Assert: ! IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is true.
|
// 3. Assert: ! IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is true.
|
||||||
VERIFY(is_valid_time(hour, minute, second, millisecond, microsecond, nanosecond));
|
VERIFY(is_valid_time(hour, minute, second, millisecond, microsecond, nanosecond));
|
||||||
|
|
||||||
// 4. Let date be ! MakeDay(𝔽(year), 𝔽(month − 1), 𝔽(day)).
|
// 4. Let date be MakeDay(𝔽(year), 𝔽(month − 1), 𝔽(day)).
|
||||||
auto date = make_day(global_object, Value(year), Value(month - 1), Value(day));
|
auto date = make_day(global_object, Value(year), Value(month - 1), Value(day));
|
||||||
|
|
||||||
// 5. Let time be ! MakeTime(𝔽(hour), 𝔽(minute), 𝔽(second), 𝔽(millisecond)).
|
// 5. Let time be MakeTime(𝔽(hour), 𝔽(minute), 𝔽(second), 𝔽(millisecond)).
|
||||||
auto time = make_time(global_object, Value(hour), Value(minute), Value(second), Value(millisecond));
|
auto time = make_time(global_object, Value(hour), Value(minute), Value(second), Value(millisecond));
|
||||||
|
|
||||||
// 6. Let ms be ! MakeDate(date, time).
|
// 6. Let ms be MakeDate(date, time).
|
||||||
auto ms = make_date(date, time);
|
auto ms = make_date(date, time);
|
||||||
|
|
||||||
// 7. Assert: ms is finite.
|
// 7. Assert: ms is finite.
|
||||||
|
@ -135,7 +135,7 @@ ThrowCompletionOr<PlainDateTime*> to_temporal_date_time(GlobalObject& global_obj
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ ThrowCompletionOr<DurationRecord> difference_iso_date_time(GlobalObject& global_
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::round)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be roundTo.
|
// a. Let paramString be roundTo.
|
||||||
|
|
||||||
// b. Set roundTo to ! OrdinaryObjectCreate(null).
|
// b. Set roundTo to OrdinaryObjectCreate(null).
|
||||||
round_to = Object::create(global_object, nullptr);
|
round_to = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
||||||
|
@ -844,7 +844,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
|
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
|
||||||
auto* date_time = TRY(typed_this_object(global_object));
|
auto* date_time = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", dateTime.[[Calendar]]).
|
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", dateTime.[[Calendar]]).
|
||||||
|
|
|
@ -38,7 +38,7 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(GlobalObject& global_obj
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(GlobalObject& global_obj
|
||||||
// 9. Set result to ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, referenceISOYear).
|
// 9. Set result to ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, referenceISOYear).
|
||||||
auto* plain_month_day = TRY(create_temporal_month_day(global_object, result.month, result.day, *calendar, reference_iso_year));
|
auto* plain_month_day = TRY(create_temporal_month_day(global_object, result.month, result.day, *calendar, reference_iso_year));
|
||||||
|
|
||||||
// 10. Let canonicalMonthDayOptions be ! OrdinaryObjectCreate(null).
|
// 10. Let canonicalMonthDayOptions be OrdinaryObjectCreate(null).
|
||||||
auto* canonical_month_day_options = Object::create(global_object, nullptr);
|
auto* canonical_month_day_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// 11. Return ? MonthDayFromFields(calendar, result, canonicalMonthDayOptions).
|
// 11. Return ? MonthDayFromFields(calendar, result, canonicalMonthDayOptions).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -245,7 +245,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date)
|
||||||
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
|
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
|
||||||
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, {}));
|
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, {}));
|
||||||
|
|
||||||
// 12. Let options be ! OrdinaryObjectCreate(null).
|
// 12. Let options be OrdinaryObjectCreate(null).
|
||||||
auto* options = Object::create(global_object, nullptr);
|
auto* options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject").
|
// 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject").
|
||||||
|
@ -262,7 +262,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
|
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
|
||||||
auto* month_day = TRY(typed_this_object(global_object));
|
auto* month_day = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", monthDay.[[Calendar]]).
|
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", monthDay.[[Calendar]]).
|
||||||
|
|
|
@ -362,7 +362,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::round)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be roundTo.
|
// a. Let paramString be roundTo.
|
||||||
|
|
||||||
// b. Set roundTo to ! OrdinaryObjectCreate(null).
|
// b. Set roundTo to OrdinaryObjectCreate(null).
|
||||||
round_to = Object::create(global_object, nullptr);
|
round_to = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
||||||
|
@ -523,7 +523,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
|
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
|
||||||
auto* temporal_time = TRY(typed_this_object(global_object));
|
auto* temporal_time = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", temporalTime.[[Calendar]]).
|
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", temporalTime.[[Calendar]]).
|
||||||
|
|
|
@ -35,7 +35,7 @@ ThrowCompletionOr<PlainYearMonth*> to_temporal_year_month(GlobalObject& global_o
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ ThrowCompletionOr<PlainYearMonth*> to_temporal_year_month(GlobalObject& global_o
|
||||||
// 8. Set result to ? CreateTemporalYearMonth(result.[[Year]], result.[[Month]], calendar, result.[[Day]]).
|
// 8. Set result to ? CreateTemporalYearMonth(result.[[Year]], result.[[Month]], calendar, result.[[Day]]).
|
||||||
auto* creation_result = TRY(create_temporal_year_month(global_object, result.year, result.month, *calendar, result.day));
|
auto* creation_result = TRY(create_temporal_year_month(global_object, result.year, result.month, *calendar, result.day));
|
||||||
|
|
||||||
// 9. Let canonicalYearMonthOptions be ! OrdinaryObjectCreate(null).
|
// 9. Let canonicalYearMonthOptions be OrdinaryObjectCreate(null).
|
||||||
auto* canonical_year_month_options = Object::create(global_object, nullptr);
|
auto* canonical_year_month_options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// 10. Return ? YearMonthFromFields(calendar, result, canonicalYearMonthOptions).
|
// 10. Return ? YearMonthFromFields(calendar, result, canonicalYearMonthOptions).
|
||||||
|
|
|
@ -283,7 +283,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::add)
|
||||||
// 12. Let durationToAdd be ! CreateTemporalDuration(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], balanceResult.[[Days]], 0, 0, 0, 0, 0, 0).
|
// 12. Let durationToAdd be ! CreateTemporalDuration(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], balanceResult.[[Days]], 0, 0, 0, 0, 0, 0).
|
||||||
auto* duration_to_add = MUST(create_temporal_duration(global_object, duration.years, duration.months, duration.weeks, balance_result.days, 0, 0, 0, 0, 0, 0));
|
auto* duration_to_add = MUST(create_temporal_duration(global_object, duration.years, duration.months, duration.weeks, balance_result.days, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// 13. Let optionsCopy be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 13. Let optionsCopy be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* options_copy = Object::create(global_object, global_object.object_prototype());
|
auto* options_copy = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 14. Let entries be ? EnumerableOwnPropertyNames(options, key+value).
|
// 14. Let entries be ? EnumerableOwnPropertyNames(options, key+value).
|
||||||
|
@ -355,7 +355,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::subtract)
|
||||||
// 12. Let durationToAdd be ! CreateTemporalDuration(−duration.[[Years]], −duration.[[Months]], −duration.[[Weeks]], −balanceResult.[[Days]], 0, 0, 0, 0, 0, 0).
|
// 12. Let durationToAdd be ! CreateTemporalDuration(−duration.[[Years]], −duration.[[Months]], −duration.[[Weeks]], −balanceResult.[[Days]], 0, 0, 0, 0, 0, 0).
|
||||||
auto* duration_to_add = MUST(create_temporal_duration(global_object, -duration.years, -duration.months, -duration.weeks, -balance_result.days, 0, 0, 0, 0, 0, 0));
|
auto* duration_to_add = MUST(create_temporal_duration(global_object, -duration.years, -duration.months, -duration.weeks, -balance_result.days, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
// 13. Let optionsCopy be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 13. Let optionsCopy be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* options_copy = Object::create(global_object, global_object.object_prototype());
|
auto* options_copy = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 14. Let entries be ? EnumerableOwnPropertyNames(options, key+value).
|
// 14. Let entries be ? EnumerableOwnPropertyNames(options, key+value).
|
||||||
|
@ -663,7 +663,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date)
|
||||||
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
|
// 11. Set mergedFields to ? PrepareTemporalFields(mergedFields, mergedFieldNames, «»).
|
||||||
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, {}));
|
merged_fields = TRY(prepare_temporal_fields(global_object, *merged_fields, merged_field_names, {}));
|
||||||
|
|
||||||
// 12. Let options be ! OrdinaryObjectCreate(null).
|
// 12. Let options be OrdinaryObjectCreate(null).
|
||||||
auto* options = Object::create(global_object, nullptr);
|
auto* options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject").
|
// 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject").
|
||||||
|
@ -680,7 +680,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
|
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
|
||||||
auto* year_month = TRY(typed_this_object(global_object));
|
auto* year_month = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", yearMonth.[[Calendar]]).
|
// 4. Perform ! CreateDataPropertyOrThrow(fields, "calendar", yearMonth.[[Calendar]]).
|
||||||
|
|
|
@ -432,7 +432,7 @@ ThrowCompletionOr<Object*> to_temporal_time_zone(GlobalObject& global_object, Va
|
||||||
|
|
||||||
// 4. If parseResult.[[Name]] is not undefined, then
|
// 4. If parseResult.[[Name]] is not undefined, then
|
||||||
if (parse_result.name.has_value()) {
|
if (parse_result.name.has_value()) {
|
||||||
// a. If ParseText(! StringToCodePoints(parseResult.[[Name]], TimeZoneNumericUTCOffset)) is not a List of errors, then
|
// a. If ParseText(StringToCodePoints(parseResult.[[Name]], TimeZoneNumericUTCOffset)) is not a List of errors, then
|
||||||
if (is_valid_time_zone_numeric_utc_offset_syntax(*parse_result.name)) {
|
if (is_valid_time_zone_numeric_utc_offset_syntax(*parse_result.name)) {
|
||||||
// i. If parseResult.[[OffsetString]] is not undefined, and ! ParseTimeZoneOffsetString(parseResult.[[OffsetString]]) ≠ ! ParseTimeZoneOffsetString(parseResult.[[Name]]), throw a RangeError exception.
|
// i. If parseResult.[[OffsetString]] is not undefined, and ! ParseTimeZoneOffsetString(parseResult.[[OffsetString]]) ≠ ! ParseTimeZoneOffsetString(parseResult.[[Name]]), throw a RangeError exception.
|
||||||
if (parse_result.offset_string.has_value() && (MUST(parse_time_zone_offset_string(global_object, *parse_result.offset_string)) != MUST(parse_time_zone_offset_string(global_object, *parse_result.name))))
|
if (parse_result.offset_string.has_value() && (MUST(parse_time_zone_offset_string(global_object, *parse_result.offset_string)) != MUST(parse_time_zone_offset_string(global_object, *parse_result.name))))
|
||||||
|
@ -472,7 +472,7 @@ ThrowCompletionOr<double> get_offset_nanoseconds_for(GlobalObject& global_object
|
||||||
if (!offset_nanoseconds_value.is_number())
|
if (!offset_nanoseconds_value.is_number())
|
||||||
return vm.throw_completion<TypeError>(global_object, ErrorType::IsNotA, "Offset nanoseconds value", "number");
|
return vm.throw_completion<TypeError>(global_object, ErrorType::IsNotA, "Offset nanoseconds value", "number");
|
||||||
|
|
||||||
// 4. If ! IsIntegralNumber(offsetNanoseconds) is false, throw a RangeError exception.
|
// 4. If IsIntegralNumber(offsetNanoseconds) is false, throw a RangeError exception.
|
||||||
if (!offset_nanoseconds_value.is_integral_number())
|
if (!offset_nanoseconds_value.is_integral_number())
|
||||||
return vm.throw_completion<RangeError>(global_object, ErrorType::IsNotAn, "Offset nanoseconds value", "integral number");
|
return vm.throw_completion<RangeError>(global_object, ErrorType::IsNotAn, "Offset nanoseconds value", "integral number");
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ ThrowCompletionOr<Object*> TimeZoneConstructor::construct(FunctionObject& new_ta
|
||||||
// 2. Set identifier to ? ToString(identifier).
|
// 2. Set identifier to ? ToString(identifier).
|
||||||
auto identifier = TRY(vm.argument(0).to_string(global_object));
|
auto identifier = TRY(vm.argument(0).to_string(global_object));
|
||||||
|
|
||||||
// 3. Let parseResult be ParseText(! StringToCodePoints(identifier), TimeZoneNumericUTCOffset).
|
// 3. Let parseResult be ParseText(StringToCodePoints(identifier), TimeZoneNumericUTCOffset).
|
||||||
// 4. If parseResult is a List of errors, then
|
// 4. If parseResult is a List of errors, then
|
||||||
if (!is_valid_time_zone_numeric_utc_offset_syntax(identifier)) {
|
if (!is_valid_time_zone_numeric_utc_offset_syntax(identifier)) {
|
||||||
// a. If ! IsValidTimeZoneName(identifier) is false, then
|
// a. If ! IsValidTimeZoneName(identifier) is false, then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -143,7 +143,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for)
|
||||||
// b. Let instant be ! CreateTemporalInstant(ℤ(epochNanoseconds − timeZone.[[OffsetNanoseconds]])).
|
// b. Let instant be ! CreateTemporalInstant(ℤ(epochNanoseconds − timeZone.[[OffsetNanoseconds]])).
|
||||||
auto* instant = MUST(create_temporal_instant(global_object, *js_bigint(vm, epoch_nanoseconds->big_integer().minus(Crypto::SignedBigInteger::create_from(*time_zone->offset_nanoseconds())))));
|
auto* instant = MUST(create_temporal_instant(global_object, *js_bigint(vm, epoch_nanoseconds->big_integer().minus(Crypto::SignedBigInteger::create_from(*time_zone->offset_nanoseconds())))));
|
||||||
|
|
||||||
// c. Return ! CreateArrayFromList(« instant »).
|
// c. Return CreateArrayFromList(« instant »).
|
||||||
return Array::create_from(global_object, { instant });
|
return Array::create_from(global_object, { instant });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for)
|
||||||
possible_instants.append(instant);
|
possible_instants.append(instant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8. Return ! CreateArrayFromList(possibleInstants).
|
// 8. Return CreateArrayFromList(possibleInstants).
|
||||||
return Array::create_from(global_object, possible_instants);
|
return Array::create_from(global_object, possible_instants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(GlobalObject& glob
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(GlobalObject& glob
|
||||||
// e. Assert: timeZoneName is not undefined.
|
// e. Assert: timeZoneName is not undefined.
|
||||||
VERIFY(time_zone_name.has_value());
|
VERIFY(time_zone_name.has_value());
|
||||||
|
|
||||||
// f. If ParseText(! StringToCodePoints(timeZoneName), TimeZoneNumericUTCOffset) is a List of errors, then
|
// f. If ParseText(StringToCodePoints(timeZoneName), TimeZoneNumericUTCOffset) is a List of errors, then
|
||||||
if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) {
|
if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) {
|
||||||
// i. If ! IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception.
|
// i. If ! IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception.
|
||||||
if (!is_valid_time_zone_name(*time_zone_name))
|
if (!is_valid_time_zone_name(*time_zone_name))
|
||||||
|
@ -367,7 +367,7 @@ ThrowCompletionOr<String> temporal_zoned_date_time_to_string(GlobalObject& globa
|
||||||
// 6.5.5 AddZonedDateTime ( epochNanoseconds, timeZone, calendar, years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-addzoneddatetime
|
// 6.5.5 AddZonedDateTime ( epochNanoseconds, timeZone, calendar, years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-addzoneddatetime
|
||||||
ThrowCompletionOr<BigInt*> add_zoned_date_time(GlobalObject& global_object, BigInt const& epoch_nanoseconds, Value time_zone, Object& calendar, double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds, Object* options)
|
ThrowCompletionOr<BigInt*> add_zoned_date_time(GlobalObject& global_object, BigInt const& epoch_nanoseconds, Value time_zone, Object& calendar, double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds, Object* options)
|
||||||
{
|
{
|
||||||
// 1. If options is not present, set options to ! OrdinaryObjectCreate(null).
|
// 1. If options is not present, set options to OrdinaryObjectCreate(null).
|
||||||
if (!options)
|
if (!options)
|
||||||
options = Object::create(global_object, nullptr);
|
options = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -1114,7 +1114,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round)
|
||||||
if (vm.argument(0).is_string()) {
|
if (vm.argument(0).is_string()) {
|
||||||
// a. Let paramString be roundTo.
|
// a. Let paramString be roundTo.
|
||||||
|
|
||||||
// b. Set roundTo to ! OrdinaryObjectCreate(null).
|
// b. Set roundTo to OrdinaryObjectCreate(null).
|
||||||
round_to = Object::create(global_object, nullptr);
|
round_to = Object::create(global_object, nullptr);
|
||||||
|
|
||||||
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
// c. Perform ! CreateDataPropertyOrThrow(roundTo, "smallestUnit", paramString).
|
||||||
|
@ -1441,7 +1441,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::get_iso_fields)
|
||||||
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
|
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
|
||||||
auto* zoned_date_time = TRY(typed_this_object(global_object));
|
auto* zoned_date_time = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
// 3. Let fields be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto* fields = Object::create(global_object, global_object.object_prototype());
|
auto* fields = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 4. Let timeZone be zonedDateTime.[[TimeZone]].
|
// 4. Let timeZone be zonedDateTime.[[TimeZone]].
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue