Commit f4e3da55 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] camelCase except-zero and narrow-symbol

Sync with https://github.com/tc39/proposal-unified-intl-numberformat/pull/54

Bug: v8:9483
Change-Id: I2aec5a78be235bddd4faa568665b73b9b84d7c93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1700426Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62819}
parent 67995f85
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
V(_, first_string, "first") \ V(_, first_string, "first") \
V(_, format_string, "format") \ V(_, format_string, "format") \
V(_, fractionalSecond_string, "fractionalSecond") \ V(_, fractionalSecond_string, "fractionalSecond") \
V(_, except_zero_string, "except-zero") \ V(_, exceptZero_string, "exceptZero") \
V(_, exponentInteger_string, "exponentInteger") \ V(_, exponentInteger_string, "exponentInteger") \
V(_, exponentMinusSign_string, "exponentMinusSign") \ V(_, exponentMinusSign_string, "exponentMinusSign") \
V(_, exponentSeparator_string, "exponentSeparator") \ V(_, exponentSeparator_string, "exponentSeparator") \
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
V(_, minute_string, "minute") \ V(_, minute_string, "minute") \
V(_, month_string, "month") \ V(_, month_string, "month") \
V(_, nan_string, "nan") \ V(_, nan_string, "nan") \
V(_, narrow_symbol_string, "narrow-symbol") \ V(_, narrowSymbol_string, "narrowSymbol") \
V(_, never_string, "never") \ V(_, never_string, "never") \
V(_, none_string, "none") \ V(_, none_string, "none") \
V(_, notation_string, "notation") \ V(_, notation_string, "notation") \
......
...@@ -42,8 +42,8 @@ enum class Style { ...@@ -42,8 +42,8 @@ enum class Style {
}; };
// [[CurrencyDisplay]] is one of the values "code", "symbol", "name", // [[CurrencyDisplay]] is one of the values "code", "symbol", "name",
// or "narrow-symbol" identifying the display of the currency number format. // or "narrowSymbol" identifying the display of the currency number format.
// Note: "narrow-symbol" is added in proposal-unified-intl-numberformat // Note: "narrowSymbol" is added in proposal-unified-intl-numberformat
enum class CurrencyDisplay { enum class CurrencyDisplay {
CODE, CODE,
SYMBOL, SYMBOL,
...@@ -95,7 +95,7 @@ enum class CompactDisplay { ...@@ -95,7 +95,7 @@ enum class CompactDisplay {
}; };
// [[SignDisplay]] is one of the String values "auto", "always", "never", or // [[SignDisplay]] is one of the String values "auto", "always", "never", or
// "except-zero", specifying whether to show the sign on negative numbers // "exceptZero", specifying whether to show the sign on negative numbers
// only, positive and negative numbers including zero, neither positive nor // only, positive and negative numbers including zero, neither positive nor
// negative numbers, or positive and negative numbers but not zero. // negative numbers, or positive and negative numbers but not zero.
enum class SignDisplay { enum class SignDisplay {
...@@ -359,7 +359,7 @@ Handle<String> CurrencyDisplayString(Isolate* isolate, ...@@ -359,7 +359,7 @@ Handle<String> CurrencyDisplayString(Isolate* isolate,
// Ex: skeleton as // Ex: skeleton as
// "currency/TWD .00 rounding-mode-half-up unit-width-narrow; // "currency/TWD .00 rounding-mode-half-up unit-width-narrow;
if (skeleton.indexOf("unit-width-narrow") >= 0) { if (skeleton.indexOf("unit-width-narrow") >= 0) {
return ReadOnlyRoots(isolate).narrow_symbol_string_handle(); return ReadOnlyRoots(isolate).narrowSymbol_string_handle();
} }
// Ex: skeleton as "currency/TWD .00 rounding-mode-half-up" // Ex: skeleton as "currency/TWD .00 rounding-mode-half-up"
return ReadOnlyRoots(isolate).symbol_string_handle(); return ReadOnlyRoots(isolate).symbol_string_handle();
...@@ -482,7 +482,7 @@ Handle<String> SignDisplayString(Isolate* isolate, ...@@ -482,7 +482,7 @@ Handle<String> SignDisplayString(Isolate* isolate,
// "currency/TWD .00 rounding-mode-half-up sign-except-zero" // "currency/TWD .00 rounding-mode-half-up sign-except-zero"
if (skeleton.indexOf("sign-accounting-except-zero") >= 0 || if (skeleton.indexOf("sign-accounting-except-zero") >= 0 ||
skeleton.indexOf("sign-except-zero") >= 0) { skeleton.indexOf("sign-except-zero") >= 0) {
return ReadOnlyRoots(isolate).except_zero_string_handle(); return ReadOnlyRoots(isolate).exceptZero_string_handle();
} }
return ReadOnlyRoots(isolate).auto_string_handle(); return ReadOnlyRoots(isolate).auto_string_handle();
} }
...@@ -1006,7 +1006,7 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1006,7 +1006,7 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
std::vector<CurrencyDisplay> currency_display_enum_values( std::vector<CurrencyDisplay> currency_display_enum_values(
{CurrencyDisplay::CODE, CurrencyDisplay::SYMBOL, CurrencyDisplay::NAME}); {CurrencyDisplay::CODE, CurrencyDisplay::SYMBOL, CurrencyDisplay::NAME});
if (FLAG_harmony_intl_numberformat_unified) { if (FLAG_harmony_intl_numberformat_unified) {
currency_display_str_values.push_back("narrow-symbol"); currency_display_str_values.push_back("narrowSymbol");
currency_display_enum_values.push_back(CurrencyDisplay::NARROW_SYMBOL); currency_display_enum_values.push_back(CurrencyDisplay::NARROW_SYMBOL);
} }
Maybe<CurrencyDisplay> maybe_currency_display = Maybe<CurrencyDisplay> maybe_currency_display =
...@@ -1210,10 +1210,10 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1210,10 +1210,10 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
if (FLAG_harmony_intl_numberformat_unified) { if (FLAG_harmony_intl_numberformat_unified) {
// 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", « // 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", «
// "auto", "never", "always", "except-zero" », "auto"). // "auto", "never", "always", "exceptZero" », "auto").
Maybe<SignDisplay> maybe_sign_display = Intl::GetStringOption<SignDisplay>( Maybe<SignDisplay> maybe_sign_display = Intl::GetStringOption<SignDisplay>(
isolate, options, "signDisplay", service, isolate, options, "signDisplay", service,
{"auto", "never", "always", "except-zero"}, {"auto", "never", "always", "exceptZero"},
{SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS, {SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS,
SignDisplay::EXCEPT_ZERO}, SignDisplay::EXCEPT_ZERO},
SignDisplay::AUTO); SignDisplay::AUTO);
......
...@@ -27,7 +27,7 @@ const testData = [ ...@@ -27,7 +27,7 @@ const testData = [
["name", "123.00 New Taiwan dollars"], ["name", "123.00 New Taiwan dollars"],
["code", "TWD 123.00"], ["code", "TWD 123.00"],
["symbol", "NT$123.00"], ["symbol", "NT$123.00"],
["narrow-symbol", "$123.00"], // new ["narrowSymbol", "$123.00"], // new
]; ];
for (const [currencyDisplay, expectation] of testData) { for (const [currencyDisplay, expectation] of testData) {
......
...@@ -15,7 +15,7 @@ const testData = [ ...@@ -15,7 +15,7 @@ const testData = [
["auto", "-123", "-0", "0", "123"], ["auto", "-123", "-0", "0", "123"],
["always", "-123", "-0", "+0", "+123"], ["always", "-123", "-0", "+0", "+123"],
["never", "123", "0", "0", "123"], ["never", "123", "0", "0", "123"],
["except-zero", "-123", "-0", "0", "+123"], ["exceptZero", "-123", "-0", "0", "+123"],
]; ];
for (const [signDisplay, neg, negZero, zero, pos] of testData) { for (const [signDisplay, neg, negZero, zero, pos] of testData) {
......
...@@ -83,6 +83,9 @@ ...@@ -83,6 +83,9 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=9319 # https://bugs.chromium.org/p/v8/issues/detail?id=9319
'intl402/NumberFormat/prototype/resolvedOptions/order': [FAIL], 'intl402/NumberFormat/prototype/resolvedOptions/order': [FAIL],
# crbug.com/v8/9483
'intl402/NumberFormat/currencyDisplay-unit': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=9084 # https://bugs.chromium.org/p/v8/issues/detail?id=9084
'intl402/supportedLocalesOf-consistent-with-resolvedOptions': [FAIL], 'intl402/supportedLocalesOf-consistent-with-resolvedOptions': [FAIL],
'intl402/fallback-locales-are-supported': [FAIL], 'intl402/fallback-locales-are-supported': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment