Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e459c79

Browse filesBrowse files
targosrichardlau
authored andcommitted
deps: V8: cherry-pick 035c305ce776
Original commit message: [Intl] call new ListFormatter::createInstance The one we currently using is now marked as internal and to be removed for 68. Migrating to the style which already avaiable in ICU 67-1. Bug: v8:11031 Change-Id: I668382a2e1b8602ddca02bf231c5008a6c92bf2d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477751 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#70638} Refs: v8/v8@035c305 PR-URL: #38497 Backport-PR-URL: #39451 Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent f552c45 commit e459c79
Copy full SHA for e459c79

2 files changed

+19-38Lines changed: 19 additions & 38 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

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

3939
##### V8 defaults for Node.js #####
4040

Collapse file

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

Copy file name to clipboardExpand all lines: deps/v8/src/objects/js-list-format.cc
+18-37Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,27 @@ namespace v8 {
2929
namespace internal {
3030

3131
namespace {
32-
const char* kStandard = "standard";
33-
const char* kOr = "or";
34-
const char* kUnit = "unit";
35-
const char* kStandardShort = "standard-short";
36-
const char* kOrShort = "or-short";
37-
const char* kUnitShort = "unit-short";
38-
const char* kStandardNarrow = "standard-narrow";
39-
const char* kOrNarrow = "or-narrow";
40-
const char* kUnitNarrow = "unit-narrow";
41-
42-
const char* GetIcuStyleString(JSListFormat::Style style,
43-
JSListFormat::Type type) {
32+
33+
UListFormatterWidth GetIcuWidth(JSListFormat::Style style) {
34+
switch (style) {
35+
case JSListFormat::Style::LONG:
36+
return ULISTFMT_WIDTH_WIDE;
37+
case JSListFormat::Style::SHORT:
38+
return ULISTFMT_WIDTH_SHORT;
39+
case JSListFormat::Style::NARROW:
40+
return ULISTFMT_WIDTH_NARROW;
41+
}
42+
UNREACHABLE();
43+
}
44+
45+
UListFormatterType GetIcuType(JSListFormat::Type type) {
4446
switch (type) {
4547
case JSListFormat::Type::CONJUNCTION:
46-
switch (style) {
47-
case JSListFormat::Style::LONG:
48-
return kStandard;
49-
case JSListFormat::Style::SHORT:
50-
return kStandardShort;
51-
case JSListFormat::Style::NARROW:
52-
return kStandardNarrow;
53-
}
48+
return ULISTFMT_TYPE_AND;
5449
case JSListFormat::Type::DISJUNCTION:
55-
switch (style) {
56-
case JSListFormat::Style::LONG:
57-
return kOr;
58-
case JSListFormat::Style::SHORT:
59-
return kOrShort;
60-
case JSListFormat::Style::NARROW:
61-
return kOrNarrow;
62-
}
50+
return ULISTFMT_TYPE_OR;
6351
case JSListFormat::Type::UNIT:
64-
switch (style) {
65-
case JSListFormat::Style::LONG:
66-
return kUnit;
67-
case JSListFormat::Style::SHORT:
68-
return kUnitShort;
69-
case JSListFormat::Style::NARROW:
70-
return kUnitNarrow;
71-
}
52+
return ULISTFMT_TYPE_UNITS;
7253
}
7354
UNREACHABLE();
7455
}
@@ -170,7 +151,7 @@ MaybeHandle<JSListFormat> JSListFormat::New(Isolate* isolate, Handle<Map> map,
170151
icu::Locale icu_locale = r.icu_locale;
171152
UErrorCode status = U_ZERO_ERROR;
172153
icu::ListFormatter* formatter = icu::ListFormatter::createInstance(
173-
icu_locale, GetIcuStyleString(style_enum, type_enum), status);
154+
icu_locale, GetIcuType(type_enum), GetIcuWidth(style_enum), status);
174155
if (U_FAILURE(status)) {
175156
delete formatter;
176157
FATAL("Failed to create ICU list formatter, are ICU data files missing?");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.