зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1746837 - Part 1: Include "mozilla/intl/MeasureUnitGenerated.h" in Spidermonkey. r=platform-i18n-reviewers,tcampbell,dminor
Differential Revision: https://phabricator.services.mozilla.com/D134303
This commit is contained in:
Родитель
7dbbf9cd8f
Коммит
04e160dc7d
|
@ -24,6 +24,7 @@ EXPORTS.mozilla.intl = [
|
|||
"src/Locale.h",
|
||||
"src/LocaleCanonicalizer.h",
|
||||
"src/MeasureUnit.h",
|
||||
"src/MeasureUnitGenerated.h",
|
||||
"src/NumberFormat.h",
|
||||
"src/NumberingSystem.h",
|
||||
"src/NumberParser.h",
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/intl/Calendar.h"
|
||||
#include "mozilla/intl/Collator.h"
|
||||
#include "mozilla/intl/Currency.h"
|
||||
#include "mozilla/intl/MeasureUnitGenerated.h"
|
||||
#include "mozilla/intl/TimeZone.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "builtin/intl/DateTimeFormat.h"
|
||||
#include "builtin/intl/FormatBuffer.h"
|
||||
#include "builtin/intl/LanguageTag.h"
|
||||
#include "builtin/intl/MeasureUnitGenerated.h"
|
||||
#include "builtin/intl/NumberFormat.h"
|
||||
#include "builtin/intl/NumberingSystemsGenerated.h"
|
||||
#include "builtin/intl/PluralRules.h"
|
||||
|
@ -781,7 +781,8 @@ static ArrayObject* AvailableTimeZones(JSContext* cx) {
|
|||
}
|
||||
|
||||
template <size_t N>
|
||||
constexpr auto MeasurementUnitNames(const intl::SimpleMeasureUnit (&units)[N]) {
|
||||
constexpr auto MeasurementUnitNames(
|
||||
const mozilla::intl::SimpleMeasureUnit (&units)[N]) {
|
||||
std::array<const char*, N> array = {};
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
array[i] = units[i].name;
|
||||
|
@ -794,7 +795,7 @@ constexpr auto MeasurementUnitNames(const intl::SimpleMeasureUnit (&units)[N]) {
|
|||
*/
|
||||
static ArrayObject* AvailableUnits(JSContext* cx) {
|
||||
static constexpr auto simpleMeasureUnitNames =
|
||||
MeasurementUnitNames(intl::simpleMeasureUnits);
|
||||
MeasurementUnitNames(mozilla::intl::simpleMeasureUnits);
|
||||
|
||||
return CreateArrayFromSortedList(cx, simpleMeasureUnitNames);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/intl/Locale.h"
|
||||
#include "mozilla/intl/MeasureUnit.h"
|
||||
#include "mozilla/intl/MeasureUnitGenerated.h"
|
||||
#include "mozilla/intl/NumberFormat.h"
|
||||
#include "mozilla/intl/NumberingSystem.h"
|
||||
#include "mozilla/intl/NumberRangeFormat.h"
|
||||
|
@ -34,7 +35,6 @@
|
|||
#include "builtin/intl/DecimalNumber.h"
|
||||
#include "builtin/intl/FormatBuffer.h"
|
||||
#include "builtin/intl/LanguageTag.h"
|
||||
#include "builtin/intl/MeasureUnitGenerated.h"
|
||||
#include "builtin/intl/RelativeTimeFormat.h"
|
||||
#include "ds/Sort.h"
|
||||
#include "gc/FreeOp.h"
|
||||
|
@ -274,7 +274,7 @@ bool js::intl_availableMeasurementUnits(JSContext* cx, unsigned argc,
|
|||
|
||||
static constexpr size_t MaxUnitLength() {
|
||||
size_t length = 0;
|
||||
for (const auto& unit : intl::simpleMeasureUnits) {
|
||||
for (const auto& unit : mozilla::intl::simpleMeasureUnits) {
|
||||
length = std::max(length, std::char_traits<char>::length(unit.name));
|
||||
}
|
||||
return length * 2 + std::char_traits<char>::length("-per-");
|
||||
|
|
Загрузка…
Ссылка в новой задаче