Skip to content

Commit ccecea5

Browse files
committed
deps: restore minimum ICU version to 65
This modifies 40df0dc so that the changes it applies are only used if ICU 67 or greater is used, and restores the previous code path for versions of ICU below 67. The minimum ICU version was bumped to 67 in Node.js 14.6.0 by #34356 but the referenced V8 commit[1] isn't on `v14.x-staging` and appears to have been reverted on V8 8.4[2] so this PR also restores the minimum ICU version to 65. [1] v8/v8@611e412 [2] v8/v8@eeccede PR-URL: #39068 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Beth Griggs <[email protected]>
1 parent 7557e74 commit ccecea5

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

deps/v8/src/objects/js-list-format.cc

+51
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,58 @@
2424
#include "unicode/fpositer.h"
2525
#include "unicode/listformatter.h"
2626
#include "unicode/ulistformatter.h"
27+
#include "unicode/uvernum.h"
2728

2829
namespace v8 {
2930
namespace internal {
3031

3132
namespace {
3233

34+
#if U_ICU_VERSION_MAJOR_NUM < 67
35+
const char* kStandard = "standard";
36+
const char* kOr = "or";
37+
const char* kUnit = "unit";
38+
const char* kStandardShort = "standard-short";
39+
const char* kOrShort = "or-short";
40+
const char* kUnitShort = "unit-short";
41+
const char* kStandardNarrow = "standard-narrow";
42+
const char* kOrNarrow = "or-narrow";
43+
const char* kUnitNarrow = "unit-narrow";
44+
45+
const char* GetIcuStyleString(JSListFormat::Style style,
46+
JSListFormat::Type type) {
47+
switch (type) {
48+
case JSListFormat::Type::CONJUNCTION:
49+
switch (style) {
50+
case JSListFormat::Style::LONG:
51+
return kStandard;
52+
case JSListFormat::Style::SHORT:
53+
return kStandardShort;
54+
case JSListFormat::Style::NARROW:
55+
return kStandardNarrow;
56+
}
57+
case JSListFormat::Type::DISJUNCTION:
58+
switch (style) {
59+
case JSListFormat::Style::LONG:
60+
return kOr;
61+
case JSListFormat::Style::SHORT:
62+
return kOrShort;
63+
case JSListFormat::Style::NARROW:
64+
return kOrNarrow;
65+
}
66+
case JSListFormat::Type::UNIT:
67+
switch (style) {
68+
case JSListFormat::Style::LONG:
69+
return kUnit;
70+
case JSListFormat::Style::SHORT:
71+
return kUnitShort;
72+
case JSListFormat::Style::NARROW:
73+
return kUnitNarrow;
74+
}
75+
}
76+
UNREACHABLE();
77+
}
78+
#else
3379
UListFormatterWidth GetIcuWidth(JSListFormat::Style style) {
3480
switch (style) {
3581
case JSListFormat::Style::LONG:
@@ -53,6 +99,7 @@ UListFormatterType GetIcuType(JSListFormat::Type type) {
5399
}
54100
UNREACHABLE();
55101
}
102+
#endif
56103

57104
} // namespace
58105

@@ -124,7 +171,11 @@ MaybeHandle<JSListFormat> JSListFormat::New(Isolate* isolate, Handle<Map> map,
124171
icu::Locale icu_locale = r.icu_locale;
125172
UErrorCode status = U_ZERO_ERROR;
126173
icu::ListFormatter* formatter = icu::ListFormatter::createInstance(
174+
#if U_ICU_VERSION_MAJOR_NUM < 67
175+
icu_locale, GetIcuStyleString(style_enum, type_enum), status);
176+
#else
127177
icu_locale, GetIcuType(type_enum), GetIcuWidth(style_enum), status);
178+
#endif
128179
if (U_FAILURE(status) || formatter == nullptr) {
129180
delete formatter;
130181
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError),

tools/icu/icu_versions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"minimum_icu": 67
2+
"minimum_icu": 65
33
}

0 commit comments

Comments
 (0)