LibJS: Update spec numbers for the Intl.DurationFormat proposal

This proposal has reached stage 4 and was merged into the ECMA-402 spec.
See: 3ff3cc7
This commit is contained in:
Timothy Flynn 2025-02-28 08:54:42 -05:00 committed by Andreas Kling
commit 5764eeab05
Notes: github-actions[bot] 2025-03-01 13:50:56 +00:00
38 changed files with 208 additions and 220 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org>
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -17,7 +17,7 @@ namespace JS::Intl {
GC_DEFINE_ALLOCATOR(SegmenterConstructor);
// 18.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
// 19.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
SegmenterConstructor::SegmenterConstructor(Realm& realm)
: NativeFunction(realm.vm().names.Segmenter.as_string(), realm.intrinsics().function_prototype())
{
@ -29,7 +29,7 @@ void SegmenterConstructor::initialize(Realm& realm)
auto& vm = this->vm();
// 18.2.1 Intl.Segmenter.prototype, https://tc39.es/ecma402/#sec-intl.segmenter.prototype
// 19.2.1 Intl.Segmenter.prototype, https://tc39.es/ecma402/#sec-intl.segmenter.prototype
define_direct_property(vm.names.prototype, realm.intrinsics().intl_segmenter_prototype(), 0);
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
@ -37,14 +37,14 @@ void SegmenterConstructor::initialize(Realm& realm)
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
}
// 18.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter
// 19.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter
ThrowCompletionOr<Value> SegmenterConstructor::call()
{
// 1. If NewTarget is undefined, throw a TypeError exception.
return vm().throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Intl.Segmenter");
}
// 18.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter
// 19.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter
ThrowCompletionOr<GC::Ref<Object>> SegmenterConstructor::construct(FunctionObject& new_target)
{
auto& vm = this->vm();
@ -90,7 +90,7 @@ ThrowCompletionOr<GC::Ref<Object>> SegmenterConstructor::construct(FunctionObjec
return segmenter;
}
// 18.2.2 Intl.Segmenter.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.segmenter.supportedlocalesof
// 19.2.2 Intl.Segmenter.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.segmenter.supportedlocalesof
JS_DEFINE_NATIVE_FUNCTION(SegmenterConstructor::supported_locales_of)
{
auto locales = vm.argument(0);