LibJS: Replace invalid reference to an [[Offset]] internal slot

This is an editorial change in the Temporal proposal. See:
f1569ef

Here, we also update the struct member name to match the correct slot
name.
This commit is contained in:
Timothy Flynn 2024-12-05 09:39:00 -05:00 committed by Tim Flynn
commit fe4995b69a
Notes: github-actions[bot] 2024-12-05 21:07:38 +00:00
5 changed files with 8 additions and 8 deletions

View file

@ -578,8 +578,8 @@ ThrowCompletionOr<RelativeTo> get_temporal_relative_to_option(VM& vm, Object con
// g. Let timeZone be fields.[[TimeZone]]. // g. Let timeZone be fields.[[TimeZone]].
time_zone = move(fields.time_zone); time_zone = move(fields.time_zone);
// h. Let offsetString be fields.[[Offset]]. // h. Let offsetString be fields.[[OffsetString]].
offset_string = move(fields.offset); offset_string = move(fields.offset_string);
// i. If offsetString is UNSET, then // i. If offsetString is UNSET, then
if (!offset_string.has_value()) { if (!offset_string.has_value()) {

View file

@ -49,7 +49,7 @@ enum class CalendarFieldConversion {
__JS_ENUMERATE(CalendarField::Millisecond, millisecond, vm.names.millisecond, CalendarFieldConversion::ToIntegerWithTruncation) \ __JS_ENUMERATE(CalendarField::Millisecond, millisecond, vm.names.millisecond, CalendarFieldConversion::ToIntegerWithTruncation) \
__JS_ENUMERATE(CalendarField::Microsecond, microsecond, vm.names.microsecond, CalendarFieldConversion::ToIntegerWithTruncation) \ __JS_ENUMERATE(CalendarField::Microsecond, microsecond, vm.names.microsecond, CalendarFieldConversion::ToIntegerWithTruncation) \
__JS_ENUMERATE(CalendarField::Nanosecond, nanosecond, vm.names.nanosecond, CalendarFieldConversion::ToIntegerWithTruncation) \ __JS_ENUMERATE(CalendarField::Nanosecond, nanosecond, vm.names.nanosecond, CalendarFieldConversion::ToIntegerWithTruncation) \
__JS_ENUMERATE(CalendarField::Offset, offset, vm.names.offset, CalendarFieldConversion::ToOffsetString) \ __JS_ENUMERATE(CalendarField::Offset, offset_string, vm.names.offset, CalendarFieldConversion::ToOffsetString) \
__JS_ENUMERATE(CalendarField::TimeZone, time_zone, vm.names.timeZone, CalendarFieldConversion::ToTemporalTimeZoneIdentifier) __JS_ENUMERATE(CalendarField::TimeZone, time_zone, vm.names.timeZone, CalendarFieldConversion::ToTemporalTimeZoneIdentifier)
struct CalendarFieldData { struct CalendarFieldData {

View file

@ -71,7 +71,7 @@ struct CalendarFields {
.millisecond = {}, .millisecond = {},
.microsecond = {}, .microsecond = {},
.nanosecond = {}, .nanosecond = {},
.offset = {}, .offset_string = {},
.time_zone = {}, .time_zone = {},
}; };
} }
@ -88,7 +88,7 @@ struct CalendarFields {
Optional<u16> millisecond { 0 }; Optional<u16> millisecond { 0 };
Optional<u16> microsecond { 0 }; Optional<u16> microsecond { 0 };
Optional<u16> nanosecond { 0 }; Optional<u16> nanosecond { 0 };
Optional<String> offset; Optional<String> offset_string;
Optional<String> time_zone; Optional<String> time_zone;
}; };

View file

@ -191,7 +191,7 @@ ThrowCompletionOr<GC::Ref<ZonedDateTime>> to_temporal_zoned_date_time(VM& vm, Va
time_zone = fields.time_zone.release_value(); time_zone = fields.time_zone.release_value();
// e. Let offsetString be fields.[[OffsetString]]. // e. Let offsetString be fields.[[OffsetString]].
offset_string = move(fields.offset); offset_string = move(fields.offset_string);
// f. If offsetString is UNSET, then // f. If offsetString is UNSET, then
if (!offset_string.has_value()) { if (!offset_string.has_value()) {

View file

@ -415,7 +415,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
fields.nanosecond = iso_date_time.time.nanosecond; fields.nanosecond = iso_date_time.time.nanosecond;
// 16. Set fields.[[OffsetString]] to FormatUTCOffsetNanoseconds(offsetNanoseconds). // 16. Set fields.[[OffsetString]] to FormatUTCOffsetNanoseconds(offsetNanoseconds).
fields.offset = format_utc_offset_nanoseconds(offset_nanoseconds); fields.offset_string = format_utc_offset_nanoseconds(offset_nanoseconds);
// 17. Let partialZonedDateTime be ? PrepareCalendarFields(calendar, temporalZonedDateTimeLike, « YEAR, MONTH, MONTH-CODE, DAY », « HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, NANOSECOND, OFFSET », PARTIAL). // 17. Let partialZonedDateTime be ? PrepareCalendarFields(calendar, temporalZonedDateTimeLike, « YEAR, MONTH, MONTH-CODE, DAY », « HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, NANOSECOND, OFFSET », PARTIAL).
static constexpr auto calendar_field_names = to_array({ CalendarField::Year, CalendarField::Month, CalendarField::MonthCode, CalendarField::Day }); static constexpr auto calendar_field_names = to_array({ CalendarField::Year, CalendarField::Month, CalendarField::MonthCode, CalendarField::Day });
@ -441,7 +441,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
auto date_time_result = TRY(interpret_temporal_date_time_fields(vm, calendar, fields, overflow)); auto date_time_result = TRY(interpret_temporal_date_time_fields(vm, calendar, fields, overflow));
// 24. Let newOffsetNanoseconds be ! ParseDateTimeUTCOffset(fields.[[OffsetString]]). // 24. Let newOffsetNanoseconds be ! ParseDateTimeUTCOffset(fields.[[OffsetString]]).
auto new_offset_nanoseconds = parse_date_time_utc_offset(*fields.offset); auto new_offset_nanoseconds = parse_date_time_utc_offset(*fields.offset_string);
// 25. Let epochNanoseconds be ? InterpretISODateTimeOffset(dateTimeResult.[[ISODate]], dateTimeResult.[[Time]], OPTION, newOffsetNanoseconds, timeZone, disambiguation, offset, MATCH-EXACTLY). // 25. Let epochNanoseconds be ? InterpretISODateTimeOffset(dateTimeResult.[[ISODate]], dateTimeResult.[[Time]], OPTION, newOffsetNanoseconds, timeZone, disambiguation, offset, MATCH-EXACTLY).
auto new_epoch_nanoseconds = TRY(interpret_iso_date_time_offset(vm, date_time_result.iso_date, date_time_result.time, OffsetBehavior::Option, new_offset_nanoseconds, time_zone, disambiguation, offset, MatchBehavior::MatchExactly)); auto new_epoch_nanoseconds = TRY(interpret_iso_date_time_offset(vm, date_time_result.iso_date, date_time_result.time, OffsetBehavior::Option, new_offset_nanoseconds, time_zone, disambiguation, offset, MatchBehavior::MatchExactly));