mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibJS: Return an enum from ApplyUnsignedRoundingMode
After the Intl MV is implemented, returning a copy of the desired value here may involve copying non-trivial data. Instead, return an enum to indicate which decision was made.
This commit is contained in:
parent
20533c2594
commit
99b79766cd
Notes:
sideshowbarker
2024-07-17 08:45:07 +09:00
Author: https://github.com/trflynn89
Commit: 99b79766cd
Pull-request: https://github.com/SerenityOS/serenity/pull/14623
Reviewed-by: https://github.com/linusg ✅
2 changed files with 18 additions and 13 deletions
|
@ -266,6 +266,11 @@ struct RawFormatResult : public FormatResult {
|
|||
int rounding_magnitude { 0 }; // [[RoundingMagnitude]]
|
||||
};
|
||||
|
||||
enum class RoundingDecision {
|
||||
LowerValue,
|
||||
HigherValue,
|
||||
};
|
||||
|
||||
int currency_digits(StringView currency);
|
||||
FormatResult format_numeric_to_string(GlobalObject& global_object, NumberFormatBase const& intl_object, Value number);
|
||||
Vector<PatternPartition> partition_number_pattern(GlobalObject& global_object, NumberFormat& number_format, Value number);
|
||||
|
@ -279,6 +284,6 @@ Optional<StringView> get_notation_sub_pattern(NumberFormat& number_format, int e
|
|||
int compute_exponent(GlobalObject& global_object, NumberFormat& number_format, Value number);
|
||||
int compute_exponent_for_magnitude(NumberFormat& number_format, int magnitude);
|
||||
NumberFormat::UnsignedRoundingMode get_unsigned_rounding_mode(NumberFormat::RoundingMode rounding_mode, bool is_negative);
|
||||
Value apply_unsigned_rounding_mode(GlobalObject& global_object, Value x, Value r1, Value r2, Optional<NumberFormat::UnsignedRoundingMode> const& unsigned_rounding_mode);
|
||||
RoundingDecision apply_unsigned_rounding_mode(GlobalObject& global_object, Value x, Value r1, Value r2, Optional<NumberFormat::UnsignedRoundingMode> const& unsigned_rounding_mode);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue