зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1437842: [Part 8] Convert IsPluralRules to GuardToPluralRules r=jandem
--HG-- extra : rebase_source : cb30888b7f88de6b8fcdd186b4709fcfb997347a
This commit is contained in:
Родитель
dd72ac6908
Коммит
c03138e2b9
|
@ -1447,8 +1447,8 @@ function initializeIntlObject(obj, type, lazyData) {
|
||||||
assert((type === "Collator" && GuardToCollator(obj) !== null) ||
|
assert((type === "Collator" && GuardToCollator(obj) !== null) ||
|
||||||
(type === "DateTimeFormat" && GuardToDateTimeFormat(obj) !== null) ||
|
(type === "DateTimeFormat" && GuardToDateTimeFormat(obj) !== null) ||
|
||||||
(type === "NumberFormat" && GuardToNumberFormat(obj) !== null) ||
|
(type === "NumberFormat" && GuardToNumberFormat(obj) !== null) ||
|
||||||
(type === "PluralRules" && IsPluralRules(obj)) ||
|
|
||||||
(type === "RelativeTimeFormat" && IsRelativeTimeFormat(obj)),
|
(type === "RelativeTimeFormat" && IsRelativeTimeFormat(obj)),
|
||||||
|
(type === "PluralRules" && GuardToPluralRules(obj) !== null) ||
|
||||||
"type must match the object's class");
|
"type must match the object's class");
|
||||||
assert(IsObject(lazyData), "non-object lazy data");
|
assert(IsObject(lazyData), "non-object lazy data");
|
||||||
|
|
||||||
|
@ -1513,8 +1513,8 @@ function maybeInternalProperties(internals) {
|
||||||
function getIntlObjectInternals(obj) {
|
function getIntlObjectInternals(obj) {
|
||||||
assert(IsObject(obj), "getIntlObjectInternals called with non-Object");
|
assert(IsObject(obj), "getIntlObjectInternals called with non-Object");
|
||||||
assert(GuardToCollator(obj) !== null || GuardToDateTimeFormat(obj) !== null ||
|
assert(GuardToCollator(obj) !== null || GuardToDateTimeFormat(obj) !== null ||
|
||||||
GuardToNumberFormat(obj) !== null || IsPluralRules(obj) ||
|
|
||||||
IsRelativeTimeFormat(obj),
|
IsRelativeTimeFormat(obj),
|
||||||
|
GuardToNumberFormat(obj) !== null || GuardToPluralRules(obj) !== null ||
|
||||||
"getIntlObjectInternals called with non-Intl object");
|
"getIntlObjectInternals called with non-Intl object");
|
||||||
|
|
||||||
var internals = UnsafeGetReservedSlot(obj, INTL_INTERNALS_OBJECT_SLOT);
|
var internals = UnsafeGetReservedSlot(obj, INTL_INTERNALS_OBJECT_SLOT);
|
||||||
|
@ -1524,8 +1524,8 @@ function getIntlObjectInternals(obj) {
|
||||||
assert((internals.type === "Collator" && GuardToCollator(obj) !== null) ||
|
assert((internals.type === "Collator" && GuardToCollator(obj) !== null) ||
|
||||||
(internals.type === "DateTimeFormat" && GuardToDateTimeFormat(obj) !== null) ||
|
(internals.type === "DateTimeFormat" && GuardToDateTimeFormat(obj) !== null) ||
|
||||||
(internals.type === "NumberFormat" && GuardToNumberFormat(obj) !== null) ||
|
(internals.type === "NumberFormat" && GuardToNumberFormat(obj) !== null) ||
|
||||||
(internals.type === "PluralRules" && IsPluralRules(obj)) ||
|
|
||||||
(internals.type === "RelativeTimeFormat" && IsRelativeTimeFormat(obj)),
|
(internals.type === "RelativeTimeFormat" && IsRelativeTimeFormat(obj)),
|
||||||
|
(internals.type === "PluralRules" && GuardToPluralRules(obj) !== null) ||
|
||||||
"type must match the object's class");
|
"type must match the object's class");
|
||||||
assert(hasOwn("lazyData", internals), "missing lazyData");
|
assert(hasOwn("lazyData", internals), "missing lazyData");
|
||||||
assert(hasOwn("internalProps", internals), "missing internalProps");
|
assert(hasOwn("internalProps", internals), "missing internalProps");
|
||||||
|
|
|
@ -78,7 +78,7 @@ function resolvePluralRulesInternals(lazyPluralRulesData) {
|
||||||
*/
|
*/
|
||||||
function getPluralRulesInternals(obj) {
|
function getPluralRulesInternals(obj) {
|
||||||
assert(IsObject(obj), "getPluralRulesInternals called with non-object");
|
assert(IsObject(obj), "getPluralRulesInternals called with non-object");
|
||||||
assert(IsPluralRules(obj), "getPluralRulesInternals called with non-PluralRules");
|
assert(GuardToPluralRules(obj) !== null, "getPluralRulesInternals called with non-PluralRules");
|
||||||
|
|
||||||
var internals = getIntlObjectInternals(obj);
|
var internals = getIntlObjectInternals(obj);
|
||||||
assert(internals.type === "PluralRules", "bad type escaped getIntlObjectInternals");
|
assert(internals.type === "PluralRules", "bad type escaped getIntlObjectInternals");
|
||||||
|
@ -105,7 +105,7 @@ function getPluralRulesInternals(obj) {
|
||||||
*/
|
*/
|
||||||
function InitializePluralRules(pluralRules, locales, options) {
|
function InitializePluralRules(pluralRules, locales, options) {
|
||||||
assert(IsObject(pluralRules), "InitializePluralRules called with non-object");
|
assert(IsObject(pluralRules), "InitializePluralRules called with non-object");
|
||||||
assert(IsPluralRules(pluralRules), "InitializePluralRules called with non-PluralRules");
|
assert(GuardToPluralRules(pluralRules) !== null, "InitializePluralRules called with non-PluralRules");
|
||||||
|
|
||||||
// Lazy PluralRules data has the following structure:
|
// Lazy PluralRules data has the following structure:
|
||||||
//
|
//
|
||||||
|
@ -196,7 +196,7 @@ function Intl_PluralRules_select(value) {
|
||||||
let pluralRules = this;
|
let pluralRules = this;
|
||||||
|
|
||||||
// Steps 2-3.
|
// Steps 2-3.
|
||||||
if (!IsObject(pluralRules) || !IsPluralRules(pluralRules))
|
if (!IsObject(pluralRules) || (pluralRules = GuardToPluralRules(pluralRules)) === null)
|
||||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "select", "PluralRules");
|
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "select", "PluralRules");
|
||||||
|
|
||||||
// Ensure the PluralRules internals are resolved.
|
// Ensure the PluralRules internals are resolved.
|
||||||
|
@ -219,7 +219,7 @@ function Intl_PluralRules_resolvedOptions() {
|
||||||
var pluralRules = this;
|
var pluralRules = this;
|
||||||
|
|
||||||
// Steps 2-3.
|
// Steps 2-3.
|
||||||
if (!IsObject(pluralRules) || !IsPluralRules(pluralRules)) {
|
if (!IsObject(pluralRules) || (pluralRules = GuardToPluralRules(pluralRules)) === null) {
|
||||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "resolvedOptions",
|
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "resolvedOptions",
|
||||||
"PluralRules");
|
"PluralRules");
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
_(IntlGuardToCollator) \
|
_(IntlGuardToCollator) \
|
||||||
_(IntlGuardToDateTimeFormat) \
|
_(IntlGuardToDateTimeFormat) \
|
||||||
_(IntlGuardToNumberFormat) \
|
_(IntlGuardToNumberFormat) \
|
||||||
_(IntlIsPluralRules) \
|
|
||||||
_(IntlIsRelativeTimeFormat) \
|
_(IntlIsRelativeTimeFormat) \
|
||||||
|
_(IntlGuardToPluralRules) \
|
||||||
\
|
\
|
||||||
_(MathAbs) \
|
_(MathAbs) \
|
||||||
_(MathFloor) \
|
_(MathFloor) \
|
||||||
|
|
|
@ -125,10 +125,10 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
|
||||||
return inlineGuardToClass(callInfo, &DateTimeFormatObject::class_);
|
return inlineGuardToClass(callInfo, &DateTimeFormatObject::class_);
|
||||||
case InlinableNative::IntlGuardToNumberFormat:
|
case InlinableNative::IntlGuardToNumberFormat:
|
||||||
return inlineGuardToClass(callInfo, &NumberFormatObject::class_);
|
return inlineGuardToClass(callInfo, &NumberFormatObject::class_);
|
||||||
case InlinableNative::IntlIsPluralRules:
|
|
||||||
return inlineHasClass(callInfo, &PluralRulesObject::class_);
|
|
||||||
case InlinableNative::IntlIsRelativeTimeFormat:
|
case InlinableNative::IntlIsRelativeTimeFormat:
|
||||||
return inlineHasClass(callInfo, &RelativeTimeFormatObject::class_);
|
return inlineHasClass(callInfo, &RelativeTimeFormatObject::class_);
|
||||||
|
case InlinableNative::IntlGuardToPluralRules:
|
||||||
|
return inlineGuardToClass(callInfo, &PluralRulesObject::class_);
|
||||||
|
|
||||||
// Math natives.
|
// Math natives.
|
||||||
case InlinableNative::MathAbs:
|
case InlinableNative::MathAbs:
|
||||||
|
|
|
@ -2572,12 +2572,12 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
||||||
JS_INLINABLE_FN("GuardToNumberFormat",
|
JS_INLINABLE_FN("GuardToNumberFormat",
|
||||||
intrinsic_GuardToBuiltin<NumberFormatObject>, 1,0,
|
intrinsic_GuardToBuiltin<NumberFormatObject>, 1,0,
|
||||||
IntlGuardToNumberFormat),
|
IntlGuardToNumberFormat),
|
||||||
JS_INLINABLE_FN("IsPluralRules",
|
|
||||||
intrinsic_IsInstanceOfBuiltin<PluralRulesObject>, 1,0,
|
|
||||||
IntlIsPluralRules),
|
|
||||||
JS_INLINABLE_FN("IsRelativeTimeFormat",
|
JS_INLINABLE_FN("IsRelativeTimeFormat",
|
||||||
intrinsic_IsInstanceOfBuiltin<RelativeTimeFormatObject>, 1,0,
|
intrinsic_IsInstanceOfBuiltin<RelativeTimeFormatObject>, 1,0,
|
||||||
IntlIsRelativeTimeFormat),
|
IntlIsRelativeTimeFormat),
|
||||||
|
JS_INLINABLE_FN("GuardToPluralRules",
|
||||||
|
intrinsic_GuardToBuiltin<PluralRulesObject>, 1,0,
|
||||||
|
IntlGuardToPluralRules),
|
||||||
JS_FN("GetDateTimeFormatConstructor",
|
JS_FN("GetDateTimeFormatConstructor",
|
||||||
intrinsic_GetBuiltinIntlConstructor<GlobalObject::getOrCreateDateTimeFormatConstructor>,
|
intrinsic_GetBuiltinIntlConstructor<GlobalObject::getOrCreateDateTimeFormatConstructor>,
|
||||||
0,0),
|
0,0),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче