Selaa lähdekoodia

LibJS: Rename ErrorType::IntlNumberIsNaN to ErrorType::NumberIsNaN

It will be used outside of the Intl namespace, so give it a less overly
specific name.
Timothy Flynn 2 vuotta sitten
vanhempi
commit
7e0083fb65

+ 1 - 1
Userland/Libraries/LibJS/Runtime/ErrorTypes.h

@@ -52,7 +52,6 @@
     M(IntlInvalidTime, "Time value must be between -8.64E15 and 8.64E15")                                                               \
     M(IntlInvalidTime, "Time value must be between -8.64E15 and 8.64E15")                                                               \
     M(IntlInvalidUnit, "Unit {} is not a valid time unit")                                                                              \
     M(IntlInvalidUnit, "Unit {} is not a valid time unit")                                                                              \
     M(IntlMinimumExceedsMaximum, "Minimum value {} is larger than maximum value {}")                                                    \
     M(IntlMinimumExceedsMaximum, "Minimum value {} is larger than maximum value {}")                                                    \
-    M(IntlNumberIsNaN, "{} must not be NaN")                                                                                            \
     M(IntlNumberIsNaNOrInfinity, "Number must not be NaN or Infinity")                                                                  \
     M(IntlNumberIsNaNOrInfinity, "Number must not be NaN or Infinity")                                                                  \
     M(IntlNumberIsNaNOrOutOfRange, "Value {} is NaN or is not between {} and {}")                                                       \
     M(IntlNumberIsNaNOrOutOfRange, "Value {} is NaN or is not between {} and {}")                                                       \
     M(IntlOptionUndefined, "Option {} must be defined when option {} is {}")                                                            \
     M(IntlOptionUndefined, "Option {} must be defined when option {} is {}")                                                            \
@@ -101,6 +100,7 @@
     M(NotIterable, "{} is not iterable")                                                                                                \
     M(NotIterable, "{} is not iterable")                                                                                                \
     M(NotObjectCoercible, "{} cannot be converted to an object")                                                                        \
     M(NotObjectCoercible, "{} cannot be converted to an object")                                                                        \
     M(NotUndefined, "{} is not undefined")                                                                                              \
     M(NotUndefined, "{} is not undefined")                                                                                              \
+    M(NumberIsNaN, "{} must not be NaN")                                                                                                \
     M(ObjectDefineOwnPropertyReturnedFalse, "Object's [[DefineOwnProperty]] method returned false")                                     \
     M(ObjectDefineOwnPropertyReturnedFalse, "Object's [[DefineOwnProperty]] method returned false")                                     \
     M(ObjectDeleteReturnedFalse, "Object's [[Delete]] method returned false")                                                           \
     M(ObjectDeleteReturnedFalse, "Object's [[Delete]] method returned false")                                                           \
     M(ObjectFreezeFailed, "Could not freeze object")                                                                                    \
     M(ObjectFreezeFailed, "Could not freeze object")                                                                                    \

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp

@@ -1793,9 +1793,9 @@ ThrowCompletionOr<Vector<PatternPartitionWithSource>> partition_number_range_pat
 {
 {
     // 1. If x is NaN or y is NaN, throw a RangeError exception.
     // 1. If x is NaN or y is NaN, throw a RangeError exception.
     if (start.is_nan())
     if (start.is_nan())
-        return vm.throw_completion<RangeError>(ErrorType::IntlNumberIsNaN, "start"sv);
+        return vm.throw_completion<RangeError>(ErrorType::NumberIsNaN, "start"sv);
     if (end.is_nan())
     if (end.is_nan())
-        return vm.throw_completion<RangeError>(ErrorType::IntlNumberIsNaN, "end"sv);
+        return vm.throw_completion<RangeError>(ErrorType::NumberIsNaN, "end"sv);
 
 
     // 2. Let result be a new empty List.
     // 2. Let result be a new empty List.
     Vector<PatternPartitionWithSource> result;
     Vector<PatternPartitionWithSource> result;

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp

@@ -147,9 +147,9 @@ ThrowCompletionOr<::Locale::PluralCategory> resolve_plural_range(VM& vm, PluralR
 
 
     // 5. If x is NaN or y is NaN, throw a RangeError exception.
     // 5. If x is NaN or y is NaN, throw a RangeError exception.
     if (start.is_nan())
     if (start.is_nan())
-        return vm.throw_completion<RangeError>(ErrorType::IntlNumberIsNaN, "start"sv);
+        return vm.throw_completion<RangeError>(ErrorType::NumberIsNaN, "start"sv);
     if (end.is_nan())
     if (end.is_nan())
-        return vm.throw_completion<RangeError>(ErrorType::IntlNumberIsNaN, "end"sv);
+        return vm.throw_completion<RangeError>(ErrorType::NumberIsNaN, "end"sv);
 
 
     // 6. Let xp be ! ResolvePlural(pluralRules, x).
     // 6. Let xp be ! ResolvePlural(pluralRules, x).
     auto start_plurality = MUST_OR_THROW_OOM(resolve_plural(vm, plural_rules, start));
     auto start_plurality = MUST_OR_THROW_OOM(resolve_plural(vm, plural_rules, start));

+ 1 - 1
Userland/Libraries/LibJS/Runtime/SetPrototype.cpp

@@ -224,7 +224,7 @@ static ThrowCompletionOr<SetRecord> get_set_record(VM& vm, Value value)
     // 4. NOTE: If rawSize is undefined, then numSize will be NaN.
     // 4. NOTE: If rawSize is undefined, then numSize will be NaN.
     // 5. If numSize is NaN, throw a TypeError exception.
     // 5. If numSize is NaN, throw a TypeError exception.
     if (number_size.is_nan())
     if (number_size.is_nan())
-        return vm.throw_completion<TypeError>(ErrorType::IntlNumberIsNaN, "size"sv);
+        return vm.throw_completion<TypeError>(ErrorType::NumberIsNaN, "size"sv);
 
 
     // 6. Let intSize be ! ToIntegerOrInfinity(numSize).
     // 6. Let intSize be ! ToIntegerOrInfinity(numSize).
     auto integer_size = MUST(number_size.to_integer_or_infinity(vm));
     auto integer_size = MUST(number_size.to_integer_or_infinity(vm));