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

Everywhere: Use _{short_,}string to create Strings from literals

This commit is contained in:
Linus Groh 2023-02-25 16:40:37 +01:00
parent 85414d9338
commit 09d40bfbb2
92 changed files with 334 additions and 310 deletions

View file

@ -99,7 +99,7 @@ ThrowCompletionOr<Calendar*> get_builtin_calendar(VM& vm, String const& identifi
Calendar* get_iso8601_calendar(VM& vm)
{
// 1. Return ! GetBuiltinCalendar("iso8601").
return MUST(get_builtin_calendar(vm, String::from_utf8("iso8601"sv).release_value_but_fixme_should_propagate_errors()));
return MUST(get_builtin_calendar(vm, "iso8601"_string.release_value_but_fixme_should_propagate_errors()));
}
// 12.2.4 CalendarFields ( calendar, fieldNames ), https://tc39.es/proposal-temporal/#sec-temporal-calendarfields
@ -824,10 +824,10 @@ ThrowCompletionOr<ISODateRecord> iso_date_from_fields(VM& vm, Object const& fiel
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ String::from_utf8_short_string("day"sv),
TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) },
{ "day"_short_string,
TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
Vector<StringView> { "year"sv, "day"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).
@ -859,9 +859,9 @@ ThrowCompletionOr<ISOYearMonth> iso_year_month_from_fields(VM& vm, Object const&
// 2. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode", "year" », « "year" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) },
{ TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
Vector<StringView> { "year"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).
@ -890,10 +890,10 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(VM& vm, Object const& f
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ String::from_utf8_short_string("day"sv),
TRY_OR_THROW_OOM(vm, String::from_utf8("month"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("monthCode"sv)),
TRY_OR_THROW_OOM(vm, String::from_utf8("year"sv)) },
{ "day"_short_string,
TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
Vector<StringView> { "day"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).