[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/+/1700426 Reviewed-by: Adam Klein <adamk@chromium.org> Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#62819}
This commit is contained in:
parent
67995f8522
commit
f4e3da5585
@ -32,7 +32,7 @@
|
||||
V(_, first_string, "first") \
|
||||
V(_, format_string, "format") \
|
||||
V(_, fractionalSecond_string, "fractionalSecond") \
|
||||
V(_, except_zero_string, "except-zero") \
|
||||
V(_, exceptZero_string, "exceptZero") \
|
||||
V(_, exponentInteger_string, "exponentInteger") \
|
||||
V(_, exponentMinusSign_string, "exponentMinusSign") \
|
||||
V(_, exponentSeparator_string, "exponentSeparator") \
|
||||
@ -70,7 +70,7 @@
|
||||
V(_, minute_string, "minute") \
|
||||
V(_, month_string, "month") \
|
||||
V(_, nan_string, "nan") \
|
||||
V(_, narrow_symbol_string, "narrow-symbol") \
|
||||
V(_, narrowSymbol_string, "narrowSymbol") \
|
||||
V(_, never_string, "never") \
|
||||
V(_, none_string, "none") \
|
||||
V(_, notation_string, "notation") \
|
||||
|
@ -42,8 +42,8 @@ enum class Style {
|
||||
};
|
||||
|
||||
// [[CurrencyDisplay]] is one of the values "code", "symbol", "name",
|
||||
// or "narrow-symbol" identifying the display of the currency number format.
|
||||
// Note: "narrow-symbol" is added in proposal-unified-intl-numberformat
|
||||
// or "narrowSymbol" identifying the display of the currency number format.
|
||||
// Note: "narrowSymbol" is added in proposal-unified-intl-numberformat
|
||||
enum class CurrencyDisplay {
|
||||
CODE,
|
||||
SYMBOL,
|
||||
@ -95,7 +95,7 @@ enum class CompactDisplay {
|
||||
};
|
||||
|
||||
// [[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
|
||||
// negative numbers, or positive and negative numbers but not zero.
|
||||
enum class SignDisplay {
|
||||
@ -359,7 +359,7 @@ Handle<String> CurrencyDisplayString(Isolate* isolate,
|
||||
// Ex: skeleton as
|
||||
// "currency/TWD .00 rounding-mode-half-up unit-width-narrow;
|
||||
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"
|
||||
return ReadOnlyRoots(isolate).symbol_string_handle();
|
||||
@ -482,7 +482,7 @@ Handle<String> SignDisplayString(Isolate* isolate,
|
||||
// "currency/TWD .00 rounding-mode-half-up sign-except-zero"
|
||||
if (skeleton.indexOf("sign-accounting-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();
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
|
||||
std::vector<CurrencyDisplay> currency_display_enum_values(
|
||||
{CurrencyDisplay::CODE, CurrencyDisplay::SYMBOL, CurrencyDisplay::NAME});
|
||||
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);
|
||||
}
|
||||
Maybe<CurrencyDisplay> maybe_currency_display =
|
||||
@ -1210,10 +1210,10 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
|
||||
|
||||
if (FLAG_harmony_intl_numberformat_unified) {
|
||||
// 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>(
|
||||
isolate, options, "signDisplay", service,
|
||||
{"auto", "never", "always", "except-zero"},
|
||||
{"auto", "never", "always", "exceptZero"},
|
||||
{SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS,
|
||||
SignDisplay::EXCEPT_ZERO},
|
||||
SignDisplay::AUTO);
|
||||
|
@ -27,7 +27,7 @@ const testData = [
|
||||
["name", "123.00 New Taiwan dollars"],
|
||||
["code", "TWD 123.00"],
|
||||
["symbol", "NT$123.00"],
|
||||
["narrow-symbol", "$123.00"], // new
|
||||
["narrowSymbol", "$123.00"], // new
|
||||
];
|
||||
|
||||
for (const [currencyDisplay, expectation] of testData) {
|
||||
|
@ -15,7 +15,7 @@ const testData = [
|
||||
["auto", "-123", "-0", "0", "123"],
|
||||
["always", "-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) {
|
||||
|
@ -83,6 +83,9 @@
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=9319
|
||||
'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
|
||||
'intl402/supportedLocalesOf-consistent-with-resolvedOptions': [FAIL],
|
||||
'intl402/fallback-locales-are-supported': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user