Skip to content

Commit

Permalink
fix nodejs compile error with icu-69
Browse files Browse the repository at this point in the history
by using backport patch from chromium

Closes #5134

Signed-off-by: Konrad Weihmann <[email protected]>
  • Loading branch information
priv-kweihmann committed Apr 19, 2021
1 parent cedfd9f commit 6805177
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
From 52e3f4e814bf2001ed8414256bf0fa02fef553dc Mon Sep 17 00:00:00 2001
From: Konrad Weihmann <[email protected]>
Date: Mon, 19 Apr 2021 17:35:26 +0200
Subject: [PATCH] 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.

Upstream-Status: Backport
Bug: v8:11031
Change-Id: I668382a2e1b8602ddca02bf231c5008a6c92bf2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477751
Reviewed-by: Jakob Kummerow <[email protected]>
Commit-Queue: Frank Tang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#70638}
Signed-off-by: Konrad Weihmann <[email protected]>
---
deps/v8/src/objects/js-list-format.cc | 55 +++++++++------------------
1 file changed, 18 insertions(+), 37 deletions(-)

diff --git a/deps/v8/src/objects/js-list-format.cc b/deps/v8/src/objects/js-list-format.cc
index 4f303b1..982e9a3 100644
--- a/deps/v8/src/objects/js-list-format.cc
+++ b/deps/v8/src/objects/js-list-format.cc
@@ -29,46 +29,27 @@ namespace v8 {
namespace internal {

namespace {
-const char* kStandard = "standard";
-const char* kOr = "or";
-const char* kUnit = "unit";
-const char* kStandardShort = "standard-short";
-const char* kOrShort = "or-short";
-const char* kUnitShort = "unit-short";
-const char* kStandardNarrow = "standard-narrow";
-const char* kOrNarrow = "or-narrow";
-const char* kUnitNarrow = "unit-narrow";
-
-const char* GetIcuStyleString(JSListFormat::Style style,
- JSListFormat::Type type) {
+
+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:
- switch (style) {
- case JSListFormat::Style::LONG:
- return kStandard;
- case JSListFormat::Style::SHORT:
- return kStandardShort;
- case JSListFormat::Style::NARROW:
- return kStandardNarrow;
- }
+ return ULISTFMT_TYPE_AND;
case JSListFormat::Type::DISJUNCTION:
- switch (style) {
- case JSListFormat::Style::LONG:
- return kOr;
- case JSListFormat::Style::SHORT:
- return kOrShort;
- case JSListFormat::Style::NARROW:
- return kOrNarrow;
- }
+ return ULISTFMT_TYPE_OR;
case JSListFormat::Type::UNIT:
- switch (style) {
- case JSListFormat::Style::LONG:
- return kUnit;
- case JSListFormat::Style::SHORT:
- return kUnitShort;
- case JSListFormat::Style::NARROW:
- return kUnitNarrow;
- }
+ return ULISTFMT_TYPE_UNITS;
}
UNREACHABLE();
}
@@ -170,7 +151,7 @@ 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(
- icu_locale, GetIcuStyleString(style_enum, type_enum), status);
+ icu_locale, GetIcuType(type_enum), GetIcuWidth(style_enum), status);
if (U_FAILURE(status)) {
delete formatter;
FATAL("Failed to create ICU list formatter, are ICU data files missing?");
--
2.25.1

1 change: 1 addition & 0 deletions recipes-devtools/nodejs-native/nodejs-native_12.22.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
file://0005-Install-both-binaries-and-use-libdir.patch \
file://0003-v8-don-t-override-ARM-CFLAGS.patch \
file://0004-Bind-python-to-nativepython3.patch \
file://0001-call-new-ListFormatter-createInstance.patch \
"

SRC_URI[md5sum] = "6c8fd17343bebfdf659d990b21453bc7"
Expand Down

0 comments on commit 6805177

Please sign in to comment.