mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:57:34 +00:00
LibWeb: Make Serialize functions infallible
This commit is contained in:
parent
788c2c5a8d
commit
b5893ee115
10 changed files with 95 additions and 105 deletions
|
@ -23,7 +23,7 @@ ErrorOr<String> Declaration::to_string() const
|
|||
{
|
||||
StringBuilder builder;
|
||||
|
||||
TRY(serialize_an_identifier(builder, m_name));
|
||||
serialize_an_identifier(builder, m_name);
|
||||
TRY(builder.try_append(": "sv));
|
||||
TRY(builder.try_join(' ', m_values));
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<String> Function::to_string() const
|
|||
{
|
||||
StringBuilder builder;
|
||||
|
||||
TRY(serialize_an_identifier(builder, m_name));
|
||||
serialize_an_identifier(builder, m_name);
|
||||
TRY(builder.try_append('('));
|
||||
TRY(builder.try_join(' ', m_values));
|
||||
TRY(builder.try_append(')'));
|
||||
|
|
|
@ -20,13 +20,13 @@ ErrorOr<String> Token::to_string() const
|
|||
case Type::Ident:
|
||||
return serialize_an_identifier(ident());
|
||||
case Type::Function:
|
||||
return String::formatted("{}(", TRY(serialize_an_identifier(function())));
|
||||
return String::formatted("{}(", serialize_an_identifier(function()));
|
||||
case Type::AtKeyword:
|
||||
return String::formatted("@{}", TRY(serialize_an_identifier(at_keyword())));
|
||||
return String::formatted("@{}", serialize_an_identifier(at_keyword()));
|
||||
case Type::Hash: {
|
||||
switch (m_hash_type) {
|
||||
case HashType::Id:
|
||||
return String::formatted("#{}", TRY(serialize_an_identifier(hash_value())));
|
||||
return String::formatted("#{}", serialize_an_identifier(hash_value()));
|
||||
case HashType::Unrestricted:
|
||||
return String::formatted("#{}", hash_value());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue