diff --git a/deps/v8/src/objects/js-list-format.cc b/deps/v8/src/objects/js-list-format.cc index 4f303b18745829..2101f8e5079567 100644 --- a/deps/v8/src/objects/js-list-format.cc +++ b/deps/v8/src/objects/js-list-format.cc @@ -29,6 +29,7 @@ namespace v8 { namespace internal { namespace { +#if U_ICU_VERSION_MAJOR_NUM < 68 const char* kStandard = "standard"; const char* kOr = "or"; const char* kUnit = "unit"; @@ -41,8 +42,24 @@ const char* kUnitNarrow = "unit-narrow"; const char* GetIcuStyleString(JSListFormat::Style style, JSListFormat::Type type) { +#else +UListFormatterWidth GetIcuWidth(JSListFormat::Style style) { + switch (style) { + case JSListFormat::Style::LONG: + return ULISTFMT_WIDTH_WIDE; + case JSListFormat::Style::SHORT: + return ULISTFMT_WIDTH_SHORT; + case JSListFormat::Style::NARROW: + return ULISTFMT_WIDTH_NARROW; + } + UNREACHABLE(); +} + +UListFormatterType GetIcuType(JSListFormat::Type type) { +#endif switch (type) { case JSListFormat::Type::CONJUNCTION: +#if U_ICU_VERSION_MAJOR_NUM < 68 switch (style) { case JSListFormat::Style::LONG: return kStandard; @@ -51,7 +68,11 @@ const char* GetIcuStyleString(JSListFormat::Style style, case JSListFormat::Style::NARROW: return kStandardNarrow; } +#else + return ULISTFMT_TYPE_AND; +#endif case JSListFormat::Type::DISJUNCTION: +#if U_ICU_VERSION_MAJOR_NUM < 68 switch (style) { case JSListFormat::Style::LONG: return kOr; @@ -60,7 +81,11 @@ const char* GetIcuStyleString(JSListFormat::Style style, case JSListFormat::Style::NARROW: return kOrNarrow; } +#else + return ULISTFMT_TYPE_OR; +#endif case JSListFormat::Type::UNIT: +#if U_ICU_VERSION_MAJOR_NUM < 68 switch (style) { case JSListFormat::Style::LONG: return kUnit; @@ -69,6 +94,9 @@ const char* GetIcuStyleString(JSListFormat::Style style, case JSListFormat::Style::NARROW: return kUnitNarrow; } +#else + return ULISTFMT_TYPE_UNITS; +#endif } UNREACHABLE(); } @@ -170,7 +198,11 @@ MaybeHandle JSListFormat::New(Isolate* isolate, Handle map, icu::Locale icu_locale = r.icu_locale; UErrorCode status = U_ZERO_ERROR; icu::ListFormatter* formatter = icu::ListFormatter::createInstance( +#if U_ICU_VERSION_MAJOR_NUM < 68 icu_locale, GetIcuStyleString(style_enum, type_enum), status); +#else + icu_locale, GetIcuType(type_enum), GetIcuWidth(style_enum), status); +#endif if (U_FAILURE(status)) { delete formatter; FATAL("Failed to create ICU list formatter, are ICU data files missing?");