Bug 1960026 - Part 2: Remove no longer needed checks for MOZ_ICU4X. r=spidermonkey-reviewers,dminor
After part 1, `JS_HAS_INTL_API` implies `MOZ_ICU4X`, so we can remove some ifdef-guards. Differential Revision: https://phabricator.services.mozilla.com/D245275
This commit is contained in:
@@ -19,6 +19,7 @@ EXPORTS.mozilla.intl = [
|
||||
"src/GeneralCategory.h",
|
||||
"src/ICU4CGlue.h",
|
||||
"src/ICU4CLibrary.h",
|
||||
"src/ICU4XGeckoDataProvider.h",
|
||||
"src/ICUError.h",
|
||||
"src/ListFormat.h",
|
||||
"src/Locale.h",
|
||||
@@ -51,6 +52,7 @@ UNIFIED_SOURCES += [
|
||||
"src/DisplayNames.cpp",
|
||||
"src/ICU4CGlue.cpp",
|
||||
"src/ICU4CLibrary.cpp",
|
||||
"src/ICU4XGeckoDataProvider.cpp",
|
||||
"src/ListFormat.cpp",
|
||||
"src/Locale.cpp",
|
||||
"src/LocaleCanonicalizer.cpp",
|
||||
@@ -71,16 +73,9 @@ UNIFIED_SOURCES += [
|
||||
if not CONFIG["JS_STANDALONE"]:
|
||||
TEST_DIRS += ["gtest"]
|
||||
|
||||
if CONFIG["MOZ_ICU4X"]:
|
||||
EXPORTS.mozilla.intl += [
|
||||
"src/ICU4XGeckoDataProvider.h",
|
||||
]
|
||||
UNIFIED_SOURCES += [
|
||||
"src/ICU4XGeckoDataProvider.cpp",
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
"/intl/icu_capi/bindings/c",
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
"/intl/icu_capi/bindings/c",
|
||||
]
|
||||
|
||||
# At the time of this writing the MOZ_HAS_MOZGLUE define must be true in order to
|
||||
# correctly include ConvertUtf8toUtf16 in certain include paths, otherwise it results
|
||||
|
||||
@@ -10,16 +10,13 @@
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
#include "mozilla/intl/ICU4XGeckoDataProvider.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#if defined(MOZ_ICU4X)
|
||||
# include "mozilla/intl/ICU4XGeckoDataProvider.h"
|
||||
# include "ICU4XGraphemeClusterSegmenter.h"
|
||||
# include "ICU4XSentenceSegmenter.h"
|
||||
# include "ICU4XWordSegmenter.h"
|
||||
#endif
|
||||
|
||||
#include "ICU4XGraphemeClusterSegmenter.h"
|
||||
#include "ICU4XSentenceSegmenter.h"
|
||||
#include "ICU4XWordSegmenter.h"
|
||||
#include "jspubtd.h"
|
||||
#include "NamespaceImports.h"
|
||||
|
||||
@@ -300,7 +297,6 @@ class SegmenterBreakIteratorType {
|
||||
bool isWordLike() const { return Interface::isWordLike(impl_); }
|
||||
};
|
||||
|
||||
#if defined(MOZ_ICU4X)
|
||||
// Each SegmenterBreakIterator interface contains the following definitions:
|
||||
//
|
||||
// - BreakIterator: Type of the ICU4X break iterator.
|
||||
@@ -445,7 +441,6 @@ static typename Interface::Segmenter* CreateSegmenter(JSContext* cx) {
|
||||
}
|
||||
return result.ok;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool EnsureInternalsResolved(JSContext* cx,
|
||||
Handle<SegmenterObject*> segmenter) {
|
||||
@@ -486,7 +481,6 @@ static bool EnsureInternalsResolved(JSContext* cx,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MOZ_ICU4X)
|
||||
switch (granularity) {
|
||||
case SegmenterGranularity::Grapheme: {
|
||||
auto* seg = CreateSegmenter<GraphemeClusterSegmenter>(cx);
|
||||
@@ -513,7 +507,6 @@ static bool EnsureInternalsResolved(JSContext* cx,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
segmenter->setLocale(locale);
|
||||
segmenter->setGranularity(granularity);
|
||||
@@ -535,7 +528,6 @@ void SegmenterObject::finalize(JS::GCContext* gcx, JSObject* obj) {
|
||||
|
||||
auto& segmenter = obj->as<SegmenterObject>();
|
||||
if (void* seg = segmenter.getSegmenter()) {
|
||||
#if defined(MOZ_ICU4X)
|
||||
switch (segmenter.getGranularity()) {
|
||||
case SegmenterGranularity::Grapheme: {
|
||||
DestroySegmenter<GraphemeClusterSegmenter>(seg);
|
||||
@@ -550,9 +542,6 @@ void SegmenterObject::finalize(JS::GCContext* gcx, JSObject* obj) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +559,6 @@ static void DestroyBreakIterator(void* brk) {
|
||||
*/
|
||||
template <typename T>
|
||||
static void DestroyBreakIterator(const T* segments) {
|
||||
#if defined(MOZ_ICU4X)
|
||||
void* brk = segments->getBreakIterator();
|
||||
MOZ_ASSERT(brk);
|
||||
|
||||
@@ -602,9 +590,6 @@ static void DestroyBreakIterator(const T* segments) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void SegmentsObject::finalize(JS::GCContext* gcx, JSObject* obj) {
|
||||
@@ -659,43 +644,31 @@ static Boundaries FindBoundaryFrom(Handle<T*> segments, int32_t index) {
|
||||
|
||||
template <typename T>
|
||||
static Boundaries GraphemeBoundaries(Handle<T*> segments, int32_t index) {
|
||||
#if defined(MOZ_ICU4X)
|
||||
if (segments->hasLatin1StringChars()) {
|
||||
return FindBoundaryFrom<GraphemeClusterSegmenter::BreakIteratorLatin1>(
|
||||
segments, index);
|
||||
}
|
||||
return FindBoundaryFrom<GraphemeClusterSegmenter::BreakIteratorTwoByte>(
|
||||
segments, index);
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static Boundaries WordBoundaries(Handle<T*> segments, int32_t index) {
|
||||
#if defined(MOZ_ICU4X)
|
||||
if (segments->hasLatin1StringChars()) {
|
||||
return FindBoundaryFrom<WordSegmenter::BreakIteratorLatin1>(segments,
|
||||
index);
|
||||
}
|
||||
return FindBoundaryFrom<WordSegmenter::BreakIteratorTwoByte>(segments, index);
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static Boundaries SentenceBoundaries(Handle<T*> segments, int32_t index) {
|
||||
#if defined(MOZ_ICU4X)
|
||||
if (segments->hasLatin1StringChars()) {
|
||||
return FindBoundaryFrom<SentenceSegmenter::BreakIteratorLatin1>(segments,
|
||||
index);
|
||||
}
|
||||
return FindBoundaryFrom<SentenceSegmenter::BreakIteratorTwoByte>(segments,
|
||||
index);
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -781,7 +754,6 @@ static bool EnsureBreakIterator(JSContext* cx, Handle<T*> segments,
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(MOZ_ICU4X)
|
||||
bool isLatin1 = segments->hasLatin1StringChars();
|
||||
|
||||
// Create a new break iterator based on the granularity and character type.
|
||||
@@ -823,9 +795,6 @@ static bool EnsureBreakIterator(JSContext* cx, Handle<T*> segments,
|
||||
MOZ_ASSERT(segments->getIndex() == 0, "index is initially zero");
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("ICU4X disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -512,7 +512,7 @@ else:
|
||||
"threading/posix/PosixThread.cpp",
|
||||
]
|
||||
|
||||
if CONFIG["JS_HAS_INTL_API"] and CONFIG["MOZ_ICU4X"]:
|
||||
if CONFIG["JS_HAS_INTL_API"]:
|
||||
LOCAL_INCLUDES += [
|
||||
"/intl/icu_capi/bindings/c",
|
||||
]
|
||||
|
||||
@@ -203,15 +203,8 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) {
|
||||
case JSProto_NumberFormat:
|
||||
case JSProto_PluralRules:
|
||||
case JSProto_RelativeTimeFormat:
|
||||
return false;
|
||||
|
||||
case JSProto_Segmenter:
|
||||
# if defined(MOZ_ICU4X)
|
||||
return false;
|
||||
# else
|
||||
return true;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef JS_HAS_TEMPORAL_API
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#if JS_HAS_INTL_API
|
||||
# include "mozilla/intl/ICU4CLibrary.h"
|
||||
# if MOZ_ICU4X
|
||||
# include "mozilla/intl/ICU4XGeckoDataProvider.h"
|
||||
# endif
|
||||
# include "mozilla/intl/ICU4XGeckoDataProvider.h"
|
||||
#endif
|
||||
#include "mozilla/TextUtils.h"
|
||||
|
||||
@@ -276,9 +274,7 @@ static void ShutdownImpl(JS::detail::FrontendOnly frontendOnly) {
|
||||
|
||||
#if JS_HAS_INTL_API
|
||||
mozilla::intl::ICU4CLibrary::Cleanup();
|
||||
# if MOZ_ICU4X
|
||||
mozilla::intl::CleanupDataProvider();
|
||||
# endif // MOZ_ICU4X
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
if (frontendOnly == FrontendOnly::No) {
|
||||
|
||||
Reference in New Issue
Block a user