Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V12.x icu 69 support. #39451

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.55',
'v8_embedder_string': '-node.56',

##### V8 defaults for Node.js #####

Expand Down
32 changes: 32 additions & 0 deletions deps/v8/src/objects/js-list-format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
#include "unicode/fpositer.h"
#include "unicode/listformatter.h"
#include "unicode/ulistformatter.h"
#include "unicode/uvernum.h"

namespace v8 {
namespace internal {

namespace {

#if U_ICU_VERSION_MAJOR_NUM < 67
const char* kStandard = "standard";
const char* kOr = "or";
const char* kUnit = "unit";
Expand Down Expand Up @@ -72,6 +75,31 @@ const char* GetIcuStyleString(JSListFormat::Style style,
}
UNREACHABLE();
}
#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) {
switch (type) {
case JSListFormat::Type::CONJUNCTION:
return ULISTFMT_TYPE_AND;
case JSListFormat::Type::DISJUNCTION:
return ULISTFMT_TYPE_OR;
case JSListFormat::Type::UNIT:
return ULISTFMT_TYPE_UNITS;
}
UNREACHABLE();
}
#endif

} // namespace

Expand Down Expand Up @@ -170,7 +198,11 @@ MaybeHandle<JSListFormat> JSListFormat::New(Isolate* isolate, Handle<Map> 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 < 67
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?");
Expand Down