summaryrefslogtreecommitdiff
path: root/js/src/vm
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-22 20:32:56 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-22 20:32:56 +0000
commit25b6703e956a33e0ecd8bdc18f423e5eb5dd09d4 (patch)
tree7c410dbb5d672661bf0a567736501ec3f5ef5191 /js/src/vm
parent911cbcd1af7d8becf9694e3b51ce773908e1a93d (diff)
downloaduxp-25b6703e956a33e0ecd8bdc18f423e5eb5dd09d4.tar.gz
Issue #1701 - Implement Intl.PluralRules API
Diffstat (limited to 'js/src/vm')
-rw-r--r--js/src/vm/CommonPropertyNames.h3
-rw-r--r--js/src/vm/GlobalObject.h6
-rw-r--r--js/src/vm/SelfHosting.cpp3
3 files changed, 12 insertions, 0 deletions
diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h
index 789a573dcc..a88406bc61 100644
--- a/js/src/vm/CommonPropertyNames.h
+++ b/js/src/vm/CommonPropertyNames.h
@@ -178,6 +178,7 @@
macro(InitializeCollator, InitializeCollator, "InitializeCollator") \
macro(InitializeDateTimeFormat, InitializeDateTimeFormat, "InitializeDateTimeFormat") \
macro(InitializeNumberFormat, InitializeNumberFormat, "InitializeNumberFormat") \
+ macro(InitializePluralRules, InitializePluralRules, "InitializePluralRules") \
macro(innermost, innermost, "innermost") \
macro(inNursery, inNursery, "inNursery") \
macro(input, input, "input") \
@@ -270,6 +271,8 @@
macro(parseInt, parseInt, "parseInt") \
macro(pattern, pattern, "pattern") \
macro(pending, pending, "pending") \
+ macro(PluralRules, PluralRules, "PluralRules") \
+ macro(PluralRulesSelect, PluralRulesSelect, "Intl_PluralRules_Select") \
macro(public, public_, "public") \
macro(preventExtensions, preventExtensions, "preventExtensions") \
macro(private, private_, "private") \
diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h
index 011f90aa16..f9c0149f12 100644
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -109,6 +109,7 @@ class GlobalObject : public NativeObject
COLLATOR_PROTO,
NUMBER_FORMAT_PROTO,
DATE_TIME_FORMAT_PROTO,
+ PLURAL_RULES_PROTO,
MODULE_PROTO,
IMPORT_ENTRY_PROTO,
EXPORT_ENTRY_PROTO,
@@ -507,6 +508,11 @@ class GlobalObject : public NativeObject
return getOrCreateObject(cx, global, DATE_TIME_FORMAT_PROTO, initIntlObject);
}
+ static JSObject*
+ getOrCreatePluralRulesPrototype(JSContext* cx, Handle<GlobalObject*> global) {
+ return getOrCreateObject(cx, global, PLURAL_RULES_PROTO, initIntlObject);
+ }
+
static bool ensureModulePrototypesCreated(JSContext *cx, Handle<GlobalObject*> global);
JSObject* maybeGetModulePrototype() {
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
index dc1dfb9fad..df326a69e7 100644
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2605,6 +2605,9 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_FN("intl_NumberFormat_availableLocales", intl_NumberFormat_availableLocales, 0,0),
JS_FN("intl_numberingSystem", intl_numberingSystem, 1,0),
JS_FN("intl_patternForSkeleton", intl_patternForSkeleton, 2,0),
+ JS_FN("intl_PluralRules_availableLocales", intl_PluralRules_availableLocales, 0,0),
+ JS_FN("intl_GetPluralCategories", intl_GetPluralCategories, 2, 0),
+ JS_FN("intl_SelectPluralRule", intl_SelectPluralRule, 2,0),
JS_INLINABLE_FN("IsRegExpObject",
intrinsic_IsInstanceOfBuiltin<RegExpObject>, 1,0,