1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

LibJS: Use else-if's in Temporal.Duration.prototype.until

This is an editorial change in the Temporal spec.

See: 3dd2397
This commit is contained in:
Luke Wilde 2021-11-16 01:50:48 +00:00 committed by Linus Groh
parent c3256a51cb
commit 014840eeca

View file

@ -333,58 +333,52 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::total)
// a. Let whole be roundResult.[[Years]]. // a. Let whole be roundResult.[[Years]].
whole = round_result.years; whole = round_result.years;
} }
// 13. Else if unit is "month", then
// 13. If unit is "month", then else if (unit == "month"sv) {
if (unit == "month"sv) {
// a. Let whole be roundResult.[[Months]]. // a. Let whole be roundResult.[[Months]].
whole = round_result.months; whole = round_result.months;
} }
// 14. Else if unit is "week", then
// 14. If unit is "week", then else if (unit == "week"sv) {
if (unit == "week"sv) {
// a. Let whole be roundResult.[[Weeks]]. // a. Let whole be roundResult.[[Weeks]].
whole = round_result.weeks; whole = round_result.weeks;
} }
// 15. Else if unit is "day", then
// 15. If unit is "day", then else if (unit == "day"sv) {
if (unit == "day"sv) {
// a. Let whole be roundResult.[[Days]]. // a. Let whole be roundResult.[[Days]].
whole = round_result.days; whole = round_result.days;
} }
// 16. Else if unit is "hour", then
// 16. If unit is "hour", then else if (unit == "hour"sv) {
if (unit == "hour"sv) {
// a. Let whole be roundResult.[[Hours]]. // a. Let whole be roundResult.[[Hours]].
whole = round_result.hours; whole = round_result.hours;
} }
// 17. Else if unit is "minute", then
// 17. If unit is "minute", then else if (unit == "minute"sv) {
if (unit == "minute"sv) {
// a. Let whole be roundResult.[[Minutes]]. // a. Let whole be roundResult.[[Minutes]].
whole = round_result.minutes; whole = round_result.minutes;
} }
// 18. Else if unit is "second", then
// 18. If unit is "second", then else if (unit == "second"sv) {
if (unit == "second"sv) {
// a. Let whole be roundResult.[[Seconds]]. // a. Let whole be roundResult.[[Seconds]].
whole = round_result.seconds; whole = round_result.seconds;
} }
// 19. Else if unit is "millisecond", then
// 19. If unit is "millisecond", then else if (unit == "millisecond"sv) {
if (unit == "millisecond"sv) {
// a. Let whole be roundResult.[[Milliseconds]]. // a. Let whole be roundResult.[[Milliseconds]].
whole = round_result.milliseconds; whole = round_result.milliseconds;
} }
// 20. Else if unit is "microsecond", then
// 20. If unit is "microsecond", then else if (unit == "microsecond"sv) {
if (unit == "microsecond"sv) {
// a. Let whole be roundResult.[[Microseconds]]. // a. Let whole be roundResult.[[Microseconds]].
whole = round_result.microseconds; whole = round_result.microseconds;
} }
// 21. Else,
else {
// a. Assert: unit is "nanosecond".
VERIFY(unit == "nanosecond"sv);
// 21. If unit is "nanosecond", then // b. Let whole be roundResult.[[Nanoseconds]].
if (unit == "nanosecond"sv) {
// a. Let whole be roundResult.[[Nanoseconds]].
whole = round_result.nanoseconds; whole = round_result.nanoseconds;
} }