Skip to content

Commit b69ceae

Browse files
moustafaraafatlinusg
authored andcommitted
LibJS: Improve alias names in ResolveISOMonth
This is an editorial change in the Temporal spec. See: tc39/proposal-temporal@01d5fbe
1 parent d758566 commit b69ceae

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -786,26 +786,26 @@ ThrowCompletionOr<double> resolve_iso_month(VM& vm, Object const& fields)
786786
if (month_code_string[0] != 0x4D)
787787
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode);
788788

789-
// 9. Let numberPart be the substring of monthCode from 1.
790-
auto number_part = month_code_string.substring(1);
789+
// 9. Let monthCodeDigits be the substring of monthCode from 1.
790+
auto month_code_digits = month_code_string.substring(1);
791791

792-
// 10. If ParseText(StringToCodePoints(numberPart), DateMonth) is a List of errors, throw a RangeError exception.
793-
auto parse_result = parse_iso8601(Production::DateMonth, number_part);
792+
// 10. If ParseText(StringToCodePoints(monthCodeDigits), DateMonth) is a List of errors, throw a RangeError exception.
793+
auto parse_result = parse_iso8601(Production::DateMonth, month_code_digits);
794794
if (!parse_result.has_value())
795795
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode);
796796

797-
// 11. Set numberPart to ! ToIntegerOrInfinity(numberPart).
798-
auto number_part_integer = MUST(Value(js_string(vm, move(number_part))).to_integer_or_infinity(vm));
797+
// 11. Let monthCodeNumber be ! ToIntegerOrInfinity(monthCodeDigits).
798+
auto month_code_number = MUST(Value(js_string(vm, move(month_code_digits))).to_integer_or_infinity(vm));
799799

800-
// 12. Assert: SameValue(monthCode, BuildISOMonthCode(numberPart)) is true.
801-
VERIFY(month_code_string == build_iso_month_code(number_part_integer));
800+
// 12. Assert: SameValue(monthCode, BuildISOMonthCode(monthCodeNumber)) is true.
801+
VERIFY(month_code_string == build_iso_month_code(month_code_number));
802802

803-
// 13. If month is not undefined and SameValue(month, numberPart) is false, throw a RangeError exception.
804-
if (!month.is_undefined() && month.as_double() != number_part_integer)
803+
// 13. If month is not undefined and SameValue(month, monthCodeNumber) is false, throw a RangeError exception.
804+
if (!month.is_undefined() && month.as_double() != month_code_number)
805805
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode);
806806

807-
// 14. Return numberPart.
808-
return number_part_integer;
807+
// 14. Return monthCodeNumber.
808+
return month_code_number;
809809
}
810810

811811
// 12.2.34 ISODateFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields

0 commit comments

Comments
 (0)