diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index be601f3592..94ef824304 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -3,22 +3,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * The Intl module specified by standard ECMA-402, - * ECMAScript Internationalization API Specification. - */ +/* Implementation of the Intl object and its non-constructor properties. */ #include "builtin/Intl.h" -#include "mozilla/Casting.h" -#include "mozilla/FloatingPoint.h" -#include "mozilla/PodOperations.h" +#include "mozilla/Assertions.h" +#include "mozilla/Likely.h" #include "mozilla/Range.h" -#include - #include "jsapi.h" -#include "jsatom.h" #include "jscntxt.h" #include "jsobj.h" @@ -30,22 +23,12 @@ #include "builtin/intl/PluralRules.h" #include "builtin/intl/RelativeTimeFormat.h" #include "builtin/intl/ScopedICUObject.h" -#include "ds/Sort.h" -#include "vm/DateTime.h" #include "vm/GlobalObject.h" -#include "vm/Interpreter.h" -#include "vm/Stack.h" -#include "vm/StringBuffer.h" -#include "vm/Unicode.h" #include "jsobjinlines.h" -#include "vm/NativeObject-inl.h" - using namespace js; -using mozilla::IsFinite; - using js::intl::CallICU; using js::intl::GetAvailableLocales; using js::intl::IcuLocale; diff --git a/js/src/builtin/Intl.h b/js/src/builtin/Intl.h index 938ab4de95..9ff3e74d76 100644 --- a/js/src/builtin/Intl.h +++ b/js/src/builtin/Intl.h @@ -6,21 +6,13 @@ #ifndef builtin_Intl_h #define builtin_Intl_h -#include "mozilla/HashFunctions.h" -#include "mozilla/MemoryReporting.h" +#include "mozilla/Attributes.h" -#include "jsalloc.h" -#include "NamespaceImports.h" +#include "js/RootingAPI.h" -#include "js/GCAPI.h" -#include "js/GCHashTable.h" - -#include "unicode/utypes.h" - -/* - * The Intl module specified by standard ECMA-402, - * ECMAScript Internationalization API Specification. - */ +struct JSContext; +class JSObject; +namespace JS { class Value; } namespace js { @@ -29,7 +21,7 @@ namespace js { * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1 */ extern JSObject* -InitIntlClass(JSContext* cx, HandleObject obj); +InitIntlClass(JSContext* cx, JS::Handle obj); /* * The following functions are for use by self-hosted code. @@ -59,7 +51,7 @@ InitIntlClass(JSContext* cx, HandleObject obj); * NOTE: "calendar" and "locale" properties are *not* added to the object. */ extern MOZ_MUST_USE bool -intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp); +intl_GetCalendarInfo(JSContext* cx, unsigned argc, JS::Value* vp); /** * Returns an Array with CLDR-based fields display names. @@ -101,34 +93,7 @@ intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp); * ] */ extern MOZ_MUST_USE bool -intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp); - -/** - * Cast char16_t* strings to UChar* strings used by ICU. - */ -inline const UChar* -Char16ToUChar(const char16_t* chars) -{ - return reinterpret_cast(chars); -} - -inline UChar* -Char16ToUChar(char16_t* chars) -{ - return reinterpret_cast(chars); -} - -inline char16_t* -UCharToChar16(UChar* chars) -{ - return reinterpret_cast(chars); -} - -inline const char16_t* -UCharToChar16(const UChar* chars) -{ - return reinterpret_cast(chars); -} +intl_ComputeDisplayNames(JSContext* cx, unsigned argc, JS::Value* vp); } // namespace js diff --git a/js/src/builtin/intl/ICUHeader.h b/js/src/builtin/intl/ICUHeader.h index 0a0e280838..08fe2c1719 100644 --- a/js/src/builtin/intl/ICUHeader.h +++ b/js/src/builtin/intl/ICUHeader.h @@ -20,4 +20,31 @@ #include "unicode/ureldatefmt.h" #include "unicode/ustring.h" +/** + * Cast char16_t* strings to UChar* strings used by ICU. + */ +inline const UChar* +Char16ToUChar(const char16_t* chars) +{ + return reinterpret_cast(chars); +} + +inline UChar* +Char16ToUChar(char16_t* chars) +{ + return reinterpret_cast(chars); +} + +inline char16_t* +UCharToChar16(UChar* chars) +{ + return reinterpret_cast(chars); +} + +inline const char16_t* +UCharToChar16(const UChar* chars) +{ + return reinterpret_cast(chars); +} + #endif /* builtin_intl_ICUHeader_h */ diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index b9e10b61b9..6726da9457 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -30,7 +30,7 @@ #include "jstypes.h" #include "jsutil.h" -#include "builtin/Intl.h" +#include "builtin/intl/ICUHeader.h" #include "builtin/RegExp.h" #include "jit/InlinableNatives.h" #include "js/Conversions.h"