mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
LibJS: Reorganize spec steps for Intl.Locale
This is an editorial change in the Intl spec: https://github.com/tc39/ecma402/commit/31f6003
This commit is contained in:
parent
6677e03a52
commit
d6868d1e9d
Notes:
sideshowbarker
2024-07-17 17:22:27 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/d6868d1e9d Pull-request: https://github.com/SerenityOS/serenity/pull/13060
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -40,7 +40,7 @@ static ThrowCompletionOr<Optional<String>> get_string_option(GlobalObject& globa
|
||||
return option.as_string().string();
|
||||
}
|
||||
|
||||
// 14.1.1 ApplyOptionsToTag ( tag, options ), https://tc39.es/ecma402/#sec-apply-options-to-tag
|
||||
// 14.1.2 ApplyOptionsToTag ( tag, options ), https://tc39.es/ecma402/#sec-apply-options-to-tag
|
||||
static ThrowCompletionOr<String> apply_options_to_tag(GlobalObject& global_object, StringView tag, Object const& options)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
@ -107,7 +107,7 @@ static ThrowCompletionOr<String> apply_options_to_tag(GlobalObject& global_objec
|
||||
return JS::Intl::canonicalize_unicode_locale_id(*locale_id);
|
||||
}
|
||||
|
||||
// 14.1.2 ApplyUnicodeExtensionToTag ( tag, options, relevantExtensionKeys ), https://tc39.es/ecma402/#sec-apply-unicode-extension-to-tag
|
||||
// 14.1.3 ApplyUnicodeExtensionToTag ( tag, options, relevantExtensionKeys ), https://tc39.es/ecma402/#sec-apply-unicode-extension-to-tag
|
||||
static LocaleAndKeys apply_unicode_extension_to_tag(StringView tag, LocaleAndKeys options, Span<StringView const> relevant_extension_keys)
|
||||
{
|
||||
// 1. Assert: Type(tag) is String.
|
||||
@ -236,14 +236,14 @@ void LocaleConstructor::initialize(GlobalObject& global_object)
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 14.1.3 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale
|
||||
// 14.1.1 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale
|
||||
ThrowCompletionOr<Value> LocaleConstructor::call()
|
||||
{
|
||||
// 1. If NewTarget is undefined, throw a TypeError exception.
|
||||
return vm().throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Intl.Locale");
|
||||
}
|
||||
|
||||
// 14.1.3 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale
|
||||
// 14.1.1 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale
|
||||
ThrowCompletionOr<Object*> LocaleConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
Loading…
Reference in New Issue
Block a user