mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1325674
- Update variable names in InitializeNumberFormat to latest spec, for readability. r=anba
--HG-- extra : rebase_source : 5d5ffb813dc385aa464bfbde5332fb2143bfa521
This commit is contained in:
parent
a96f0e6d35
commit
d8c066294a
@ -1786,11 +1786,11 @@ function resolveNumberFormatInternals(lazyNumberFormatData) {
|
||||
|
||||
// Compute formatting options.
|
||||
// Step 15.
|
||||
var s = lazyNumberFormatData.style;
|
||||
internalProps.style = s;
|
||||
var style = lazyNumberFormatData.style;
|
||||
internalProps.style = style;
|
||||
|
||||
// Steps 19, 21.
|
||||
if (s === "currency") {
|
||||
if (style === "currency") {
|
||||
internalProps.currency = lazyNumberFormatData.currency;
|
||||
internalProps.currencyDisplay = lazyNumberFormatData.currencyDisplay;
|
||||
}
|
||||
@ -1954,15 +1954,15 @@ function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
|
||||
// Compute formatting options.
|
||||
// Step 14.
|
||||
var s = GetOption(options, "style", "string", ["decimal", "percent", "currency"], "decimal");
|
||||
lazyNumberFormatData.style = s;
|
||||
var style = GetOption(options, "style", "string", ["decimal", "percent", "currency"], "decimal");
|
||||
lazyNumberFormatData.style = style;
|
||||
|
||||
// Steps 16-19.
|
||||
var c = GetOption(options, "currency", "string", undefined, undefined);
|
||||
if (c !== undefined && !IsWellFormedCurrencyCode(c))
|
||||
ThrowRangeError(JSMSG_INVALID_CURRENCY_CODE, c);
|
||||
var cDigits;
|
||||
if (s === "currency") {
|
||||
if (style === "currency") {
|
||||
if (c === undefined)
|
||||
ThrowTypeError(JSMSG_UNDEFINED_CURRENCY);
|
||||
|
||||
@ -1974,17 +1974,17 @@ function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
|
||||
// Step 20.
|
||||
var cd = GetOption(options, "currencyDisplay", "string", ["code", "symbol", "name"], "symbol");
|
||||
if (s === "currency")
|
||||
if (style === "currency")
|
||||
lazyNumberFormatData.currencyDisplay = cd;
|
||||
|
||||
// Steps 22-24.
|
||||
SetNumberFormatDigitOptions(lazyNumberFormatData, options, s === "currency" ? cDigits: 0);
|
||||
SetNumberFormatDigitOptions(lazyNumberFormatData, options, style === "currency" ? cDigits: 0);
|
||||
|
||||
// Step 25.
|
||||
if (lazyNumberFormatData.maximumFractionDigits === undefined) {
|
||||
let mxfdDefault = s === "currency"
|
||||
let mxfdDefault = style === "currency"
|
||||
? cDigits
|
||||
: s === "percent"
|
||||
: style === "percent"
|
||||
? 0
|
||||
: 3;
|
||||
lazyNumberFormatData.maximumFractionDigits =
|
||||
|
Loading…
Reference in New Issue
Block a user