[Temporal] Sync PR 2297 change ToSecondsStringPrecision
Validate fractionalSecondDigits after truncation https://github.com/tc39/proposal-temporal/pull/2297 Spec text: https://tc39.es/proposal-temporal/#sec-temporal-tosecondsstringprecision Bug: v8:11544 Change-Id: I648f087f4fa2cfd6245c7946cfa625a7c5e3b3b9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3855702 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#82801}
This commit is contained in:
parent
a7c7c4dc12
commit
0f901f00e8
@ -15698,18 +15698,18 @@ Maybe<StringPrecision> ToSecondsStringPrecision(
|
|||||||
factory->fractionalSecondDigits_string()),
|
factory->fractionalSecondDigits_string()),
|
||||||
Nothing<StringPrecision>());
|
Nothing<StringPrecision>());
|
||||||
}
|
}
|
||||||
// 12. If ℝ(fractionalDigitsVal) < 0 or ℝ(fractionalDigitsVal) > 9, throw a
|
// 12. Let fractionalDigitCount be RoundTowardsZero(ℝ(fractionalDigitsVal)).
|
||||||
|
int64_t fractional_digit_count =
|
||||||
|
RoundTowardsZero(fractional_digits_val->Number());
|
||||||
|
// 13. If fractionalDigitCount < 0 or fractionalDigitCount > 9, throw a
|
||||||
// RangeError exception.
|
// RangeError exception.
|
||||||
if (fractional_digits_val->Number() < 0 ||
|
if (fractional_digit_count < 0 || fractional_digit_count > 9) {
|
||||||
fractional_digits_val->Number() > 9) {
|
|
||||||
THROW_NEW_ERROR_RETURN_VALUE(
|
THROW_NEW_ERROR_RETURN_VALUE(
|
||||||
isolate,
|
isolate,
|
||||||
NewRangeError(MessageTemplate::kPropertyValueOutOfRange,
|
NewRangeError(MessageTemplate::kPropertyValueOutOfRange,
|
||||||
factory->fractionalSecondDigits_string()),
|
factory->fractionalSecondDigits_string()),
|
||||||
Nothing<StringPrecision>());
|
Nothing<StringPrecision>());
|
||||||
}
|
}
|
||||||
// 13. Let fractionalDigitCount be floor(ℝ(fractionalDigitsVal)).
|
|
||||||
int32_t fractional_digit_count = std::floor(fractional_digits_val->Number());
|
|
||||||
// 14. If fractionalDigitCount is 0, then
|
// 14. If fractionalDigitCount is 0, then
|
||||||
switch (fractional_digit_count) {
|
switch (fractional_digit_count) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -685,14 +685,9 @@
|
|||||||
'intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition': [FAIL],
|
'intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition': [FAIL],
|
||||||
'intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition': [FAIL],
|
'intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition': [FAIL],
|
||||||
|
|
||||||
'built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
|
|
||||||
'built-ins/Temporal/Instant/prototype/add/minimum-maximum-instant': [FAIL],
|
'built-ins/Temporal/Instant/prototype/add/minimum-maximum-instant': [FAIL],
|
||||||
'built-ins/Temporal/Instant/prototype/subtract/minimum-maximum-instant': [FAIL],
|
'built-ins/Temporal/Instant/prototype/subtract/minimum-maximum-instant': [FAIL],
|
||||||
'built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
|
|
||||||
'built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
|
|
||||||
'built-ins/Temporal/PlainMonthDay/refisoyear-out-of-range': [FAIL],
|
'built-ins/Temporal/PlainMonthDay/refisoyear-out-of-range': [FAIL],
|
||||||
'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
|
|
||||||
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
|
|
||||||
'intl402/Temporal/TimeZone/from/etc-timezone': [FAIL],
|
'intl402/Temporal/TimeZone/from/etc-timezone': [FAIL],
|
||||||
'intl402/Temporal/TimeZone/from/iana-legacy-names': [FAIL],
|
'intl402/Temporal/TimeZone/from/iana-legacy-names': [FAIL],
|
||||||
'intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries': [FAIL],
|
'intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries': [FAIL],
|
||||||
|
Loading…
Reference in New Issue
Block a user