1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:05:06 +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

@ -73,7 +73,7 @@ void replace_logical_aliases(JsonObject& properties)
if (logical_alias_for.has_value()) {
auto const& aliased_properties = logical_alias_for.value();
for (auto const& aliased_property : aliased_properties.values()) {
logical_aliases.set(name, aliased_property.to_byte_string());
logical_aliases.set(name, aliased_property.as_string());
}
}
});
@ -768,7 +768,7 @@ size_t property_maximum_value_count(PropertyID property_id)
VERIFY(max_values.has_value() && max_values->is_number() && !max_values->is_double());
auto property_generator = generator.fork();
property_generator.set("name:titlecase", title_casify(name));
property_generator.set("max_values", max_values->to_byte_string());
property_generator.set("max_values", max_values->template serialized<StringBuilder>());
property_generator.append(R"~~~(
case PropertyID::@name:titlecase@:
return @max_values@;
@ -834,7 +834,7 @@ Vector<PropertyID> longhands_for_shorthand(PropertyID property_id)
first = false;
else
builder.append(", "sv);
builder.appendff("PropertyID::{}", title_casify(longhand.to_byte_string()));
builder.appendff("PropertyID::{}", title_casify(longhand.as_string()));
return IterationDecision::Continue;
});
property_generator.set("longhands", builder.to_byte_string());