mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibJS: Use is_unicode_surrogate more
No behavior change.
This commit is contained in:
parent
868b358b1a
commit
401246ae21
2 changed files with 2 additions and 2 deletions
|
@ -383,7 +383,7 @@ DeprecatedString JSONObject::quote_json_string(DeprecatedString string)
|
|||
break;
|
||||
default:
|
||||
// b. Else if C has a numeric value less than 0x0020 (SPACE), or if C has the same numeric value as a leading surrogate or trailing surrogate, then
|
||||
if (code_point < 0x20 || Utf16View::is_high_surrogate(code_point) || Utf16View::is_low_surrogate(code_point)) {
|
||||
if (code_point < 0x20 || is_unicode_surrogate(code_point)) {
|
||||
// i. Let unit be the code unit whose numeric value is that of C.
|
||||
// ii. Set product to the string-concatenation of product and UnicodeEscape(unit).
|
||||
builder.appendff("\\u{:04x}", code_point);
|
||||
|
|
|
@ -121,7 +121,7 @@ CodePoint code_point_at(Utf16View const& string, size_t position)
|
|||
auto code_point = static_cast<u32>(first);
|
||||
|
||||
// 5. If first is not a leading surrogate or trailing surrogate, then
|
||||
if (!Utf16View::is_high_surrogate(first) && !Utf16View::is_low_surrogate(first)) {
|
||||
if (!is_unicode_surrogate(first)) {
|
||||
// a. Return the Record { [[CodePoint]]: cp, [[CodeUnitCount]]: 1, [[IsUnpairedSurrogate]]: false }.
|
||||
return { false, code_point, 1 };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue