summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-28 13:11:34 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-28 19:38:47 +0000
commit348059bffda77b3748dd85e576f16f5513e57428 (patch)
tree77202ae230cc227f7b7dfe172f08e8f909dd4a0b /Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
parent0087804d109e0058bc3b56408ec4d97455c3648f (diff)
downloadserenity-348059bffda77b3748dd85e576f16f5513e57428.zip
LibJS: Implement the Intl.PluralRules constructor
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
index 161c746938..95ba0d416e 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
@@ -38,13 +38,17 @@ ThrowCompletionOr<Value> PluralRulesConstructor::call()
// 16.2.1 Intl.PluralRules ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.pluralrules
ThrowCompletionOr<Object*> PluralRulesConstructor::construct(FunctionObject& new_target)
{
+ auto& vm = this->vm();
auto& global_object = this->global_object();
+ auto locales = vm.argument(0);
+ auto options = vm.argument(1);
+
// 2. Let pluralRules be ? OrdinaryCreateFromConstructor(NewTarget, "%PluralRules.prototype%", ยซ [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]] ยป).
auto* plural_rules = TRY(ordinary_create_from_constructor<PluralRules>(global_object, new_target, &GlobalObject::intl_plural_rules_prototype));
// 3. Return ? InitializePluralRules(pluralRules, locales, options).
- return plural_rules;
+ return TRY(initialize_plural_rules(global_object, *plural_rules, locales, options));
}
}