1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:07:46 +00:00

Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string

`JsonValue::to_byte_string` has peculiar type-erasure semantics which is
not usually intended. Unfortunately, it also has a very stereotypical
name which does not warn about unexpected behavior. So let's prefix it
with `deprecated_` to make new code use `as_string` if it just wants to
get string value or `serialized<StringBuilder>` if it needs to do proper
serialization.
This commit is contained in:
Dan Klishch 2024-01-06 15:49:17 -05:00 committed by Andrew Kaster
parent 4ed5287792
commit ccd701809f
20 changed files with 46 additions and 50 deletions

View file

@ -85,7 +85,7 @@ public:
return alternative;
}
ByteString to_byte_string() const
ByteString deprecated_to_byte_string() const
{
if (is_string())
return as_string();
@ -290,7 +290,7 @@ template<>
struct Formatter<JsonValue> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, JsonValue const& value)
{
return Formatter<StringView>::format(builder, value.to_byte_string());
return Formatter<StringView>::format(builder, value.serialized<StringBuilder>());
}
};