mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 21:12:08 +02:00
LibJS+LibUnicode: Port Intl.Collator to UTF-16 strings
This commit is contained in:
committed by
Andreas Kling
parent
09c031fa96
commit
b2f053e783
Notes:
github-actions[bot]
2025-07-24 08:41:46 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b2f053e783d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5581
@@ -48,17 +48,17 @@ ThrowCompletionOr<Value> CollatorCompareFunction::call()
|
||||
// 4. If y is not provided, let y be undefined.
|
||||
|
||||
// 5. Let X be ? ToString(x).
|
||||
auto x = TRY(vm.argument(0).to_string(vm));
|
||||
auto x = TRY(vm.argument(0).to_utf16_string(vm));
|
||||
|
||||
// 6. Let Y be ? ToString(y).
|
||||
auto y = TRY(vm.argument(1).to_string(vm));
|
||||
auto y = TRY(vm.argument(1).to_utf16_string(vm));
|
||||
|
||||
// 7. Return CompareStrings(collator, X, Y).
|
||||
return compare_strings(m_collator, x, y);
|
||||
}
|
||||
|
||||
// 10.3.3.2 CompareStrings ( collator, x, y ), https://tc39.es/ecma402/#sec-collator-comparestrings
|
||||
int compare_strings(Collator const& collator, StringView x, StringView y)
|
||||
int compare_strings(Collator const& collator, Utf16View const& x, Utf16View const& y)
|
||||
{
|
||||
auto result = collator.collator().compare(x, y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user