AK+Everywhere: Change StringView case conversions to return String

There's a bit of a UTF-8 assumption with this change. But nearly every
caller of these methods were immediately creating a String from the
resulting ByteString anyways.
This commit is contained in:
Timothy Flynn 2025-04-06 10:19:35 -04:00 committed by Andreas Kling
commit 0a256b0a9a
Notes: github-actions[bot] 2025-04-07 15:45:50 +00:00
15 changed files with 57 additions and 56 deletions

View file

@ -103,7 +103,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "region"sv);
// b. Return the ASCII-uppercase of code.
return PrimitiveString::create(vm, code.to_uppercase_string());
return PrimitiveString::create(vm, code.to_ascii_uppercase_string());
}
// 3. If type is "script", then
@ -119,7 +119,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
// c. Let first be the ASCII-uppercase of the substring of code from 0 to 1.
// d. Let rest be the ASCII-lowercase of the substring of code from 1.
// e. Return the string-concatenation of first and rest.
return PrimitiveString::create(vm, code.to_titlecase_string());
return PrimitiveString::create(vm, code.to_ascii_titlecase_string());
}
// 4. If type is "calendar", then
@ -133,7 +133,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "calendar"sv);
// c. Return the ASCII-lowercase of code.
return PrimitiveString::create(vm, code.to_lowercase_string());
return PrimitiveString::create(vm, code.to_ascii_lowercase_string());
}
// 5. If type is "dateTimeField", then
@ -154,7 +154,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "currency"sv);
// 8. Return the ASCII-uppercase of code.
return PrimitiveString::create(vm, code.to_uppercase_string());
return PrimitiveString::create(vm, code.to_ascii_uppercase_string());
}
// 12.5.2 IsValidDateTimeFieldCode ( field ), https://tc39.es/ecma402/#sec-isvaliddatetimefieldcode