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