1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:57:36 +00:00

Everywhere: Use '_{short_,}string' literals more

This mostly updates code what was written before but merged after these
were added.
This commit is contained in:
Linus Groh 2023-02-28 13:50:29 +00:00
parent d0ba5f2ed7
commit 51c3967516
15 changed files with 94 additions and 95 deletions

View file

@ -108,7 +108,7 @@ NonnullRefPtr<::Shell::AST::Node> ShellComprehensionEngine::DocumentData::parse(
if (auto node = parser.parse())
return node.release_nonnull();
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, String::from_utf8("Unable to parse file"sv).release_value_but_fixme_should_propagate_errors());
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, "Unable to parse file"_string.release_value_but_fixme_should_propagate_errors());
}
size_t ShellComprehensionEngine::resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position)

View file

@ -152,7 +152,7 @@ VM::VM(OwnPtr<CustomData> custom_data)
};
#define __JS_ENUMERATE(SymbolName, snake_name) \
m_well_known_symbol_##snake_name = Symbol::create(*this, String::from_utf8("Symbol." #SymbolName##sv).release_value_but_fixme_should_propagate_errors(), false);
m_well_known_symbol_##snake_name = Symbol::create(*this, "Symbol." #SymbolName##_string.release_value_but_fixme_should_propagate_errors(), false);
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE

View file

@ -39,7 +39,7 @@ String const& Plugin::name() const
JS::ThrowCompletionOr<String> Plugin::description() const
{
// The Plugin interface's description getter steps are to return "Portable Document Format".
static String description_string = TRY_OR_THROW_OOM(vm(), String::from_utf8("Portable Document Format"sv));
static String description_string = TRY_OR_THROW_OOM(vm(), "Portable Document Format"_string);
return description_string;
}
@ -47,7 +47,7 @@ JS::ThrowCompletionOr<String> Plugin::description() const
JS::ThrowCompletionOr<String> Plugin::filename() const
{
// The Plugin interface's filename getter steps are to return "internal-pdf-viewer".
static String filename_string = TRY_OR_THROW_OOM(vm(), String::from_utf8("internal-pdf-viewer"sv));
static String filename_string = TRY_OR_THROW_OOM(vm(), "internal-pdf-viewer"_string);
return filename_string;
}

View file

@ -1104,9 +1104,8 @@ Vector<JS::NonnullGCPtr<MimeType>> Window::pdf_viewer_mime_type_objects()
return {};
if (m_pdf_viewer_mime_type_objects.is_empty()) {
// FIXME: Remove the MUSTs and propagate the errors instead.
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), MUST(String::from_utf8("application/pdf"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), MUST(String::from_utf8("text/pdf"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "application/pdf"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "text/pdf"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
}
return m_pdf_viewer_mime_type_objects;