1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Generalize Intl.NumberFormat to operate on Value types

Intl.NumberFormat is meant to format both Number and BigInt types. To
prepare for formatting BigInt types, this generalizes our NumberFormat
implementation to operate on Value instances rather than doubles. All
arithmetic is moved to static helpers that can now be updated with
BigInt semantics.
This commit is contained in:
Timothy Flynn 2022-01-30 10:41:07 -05:00 committed by Linus Groh
parent 4ba4e4c777
commit a0253af8c1
7 changed files with 150 additions and 79 deletions

View file

@ -249,7 +249,7 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> partition_relative_time_patt
auto patterns = find_patterns_for_tense_or_number(tense);
// 20. Let fv be ! PartitionNumberPattern(relativeTimeFormat.[[NumberFormat]], value).
auto value_partitions = partition_number_pattern(relative_time_format.number_format(), value);
auto value_partitions = partition_number_pattern(global_object, relative_time_format.number_format(), Value(value));
// 21. Let pr be ! ResolvePlural(relativeTimeFormat.[[PluralRules]], value).
// 22. Let pattern be po.[[<pr>]].