summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-12 10:53:04 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-14 19:12:48 +0000
commit822e32eb117b92609d5727c3226a441deaf71d7e (patch)
tree6d89759d11141826dbacda2ba6d862c634289217 /Userland/Libraries/LibJS
parent0ff4d8100ff0afa04cd6df74a577c4d6270265ae (diff)
downloadserenity-822e32eb117b92609d5727c3226a441deaf71d7e.zip
LibJS: Reword and reorder some steps of the Intl ResolveLocale AO
This is an editorial change in the ECMA-402 spec. See: https://github.com/tc39/ecma402/commit/4c55823
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp
index 3bf7d278b0..2248532467 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp
@@ -489,32 +489,29 @@ ThrowCompletionOr<LocaleResult> resolve_locale(Vector<DeprecatedString> const& r
}
}
- // iv. If keyLocaleData contains optionsValue, then
- if (options_value.has_value() && key_locale_data.contains_slow(*options_value)) {
- // 1. If SameValue(optionsValue, value) is false, then
- if (options_value != value) {
- // a. Let value be optionsValue.
- value = move(options_value);
-
- // b. Let supportedExtensionAddition be "".
- supported_extension_addition.clear();
- }
+ // iv. If SameValue(optionsValue, value) is false and keyLocaleData contains optionsValue, then
+ if (options_value.has_value() && (options_value != value) && key_locale_data.contains_slow(*options_value)) {
+ // 1. Let value be optionsValue.
+ value = move(options_value);
+
+ // 2. Let supportedExtensionAddition be "".
+ supported_extension_addition.clear();
}
// j. Set result.[[<key>]] to value.
find_key_in_value(result, key) = move(value);
- // k. Append supportedExtensionAddition to supportedExtension.
+ // k. Set supportedExtension to the string-concatenation of supportedExtension and supportedExtensionAddition.
if (supported_extension_addition.has_value())
supported_extension.keywords.append(supported_extension_addition.release_value());
}
- // 10. If the number of elements in supportedExtension is greater than 2, then
+ // 10. If supportedExtension is not "-u", then
if (!supported_extension.keywords.is_empty()) {
auto locale_id = ::Locale::parse_unicode_locale_id(found_locale);
VERIFY(locale_id.has_value());
- // a. Let foundLocale be InsertUnicodeExtensionAndCanonicalize(foundLocale, supportedExtension).
+ // a. Set foundLocale to InsertUnicodeExtensionAndCanonicalize(foundLocale, supportedExtension).
found_locale = insert_unicode_extension_and_canonicalize(locale_id.release_value(), move(supported_extension));
}