summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-01-26 14:22:47 +0000
committerLinus Groh <mail@linusgroh.de>2023-01-26 20:20:54 +0000
commit90a1de564c7e3dfb415695ea3249176043c03d42 (patch)
tree1417c5bcce8563a6d39c86df699ffff3e3393a91 /Userland/Libraries
parent82ba940646037ee9a0536c1eed7cc151a73b4297 (diff)
downloadserenity-90a1de564c7e3dfb415695ea3249176043c03d42.zip
LibJS: Make parse_temporal_*_string() take a StringView
The underlying parse_iso8601() function already does this as well.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp24
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h22
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp2
10 files changed, 31 insertions, 31 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp
index ace23c744d..8482aacbe6 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp
@@ -629,7 +629,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(VM& vm, Object const& optio
// 7. Else,
else {
// a. Let string be ? ToString(value).
- auto string = TRY(value.to_deprecated_string(vm));
+ auto string = TRY(value.to_string(vm));
// b. Let result be ? ParseTemporalRelativeToString(string).
result = TRY(parse_temporal_relative_to_string(vm, string));
@@ -1374,7 +1374,7 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(VM& vm, ParseResult const& pa
}
// 13.29 ParseTemporalInstantString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalinstantstring
-ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM& vm, StringView iso_string)
{
// 1. If ParseText(StringToCodePoints(isoString), TemporalInstantString) is a List of errors, throw a RangeError exception.
auto parse_result = parse_iso8601(Production::TemporalInstantString, iso_string);
@@ -1401,7 +1401,7 @@ ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM& vm, Depreca
}
// 13.30 ParseTemporalZonedDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalzoneddatetimestring
-ThrowCompletionOr<ISODateTime> parse_temporal_zoned_date_time_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<ISODateTime> parse_temporal_zoned_date_time_string(VM& vm, StringView iso_string)
{
// 1. If ParseText(StringToCodePoints(isoString), TemporalZonedDateTimeString) is a List of errors, throw a RangeError exception.
auto parse_result = parse_iso8601(Production::TemporalZonedDateTimeString, iso_string);
@@ -1413,7 +1413,7 @@ ThrowCompletionOr<ISODateTime> parse_temporal_zoned_date_time_string(VM& vm, Dep
}
// 13.31 ParseTemporalCalendarString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring
-ThrowCompletionOr<DeprecatedString> parse_temporal_calendar_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<DeprecatedString> parse_temporal_calendar_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be Completion(ParseISODateTime(isoString)).
auto parse_result_completion = parse_iso_date_time(vm, iso_string);
@@ -1445,7 +1445,7 @@ ThrowCompletionOr<DeprecatedString> parse_temporal_calendar_string(VM& vm, Depre
}
// 13.32 ParseTemporalDateString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatestring
-ThrowCompletionOr<TemporalDate> parse_temporal_date_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<TemporalDate> parse_temporal_date_string(VM& vm, StringView iso_string)
{
// 1. Let parts be ? ParseTemporalDateTimeString(isoString).
auto parts = TRY(parse_temporal_date_time_string(vm, iso_string));
@@ -1455,7 +1455,7 @@ ThrowCompletionOr<TemporalDate> parse_temporal_date_string(VM& vm, DeprecatedStr
}
// 13.33 ParseTemporalDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatetimestring
-ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalDateTimeString).
auto parse_result = parse_iso8601(Production::TemporalDateTimeString, iso_string);
@@ -1473,7 +1473,7 @@ ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(VM& vm, Deprecate
}
// 13.34 ParseTemporalDurationString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring
-ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(VM& vm, StringView iso_string)
{
// 1. Let duration be ParseText(StringToCodePoints(isoString), TemporalDurationString).
auto parse_result = parse_iso8601(Production::TemporalDurationString, iso_string);
@@ -1609,7 +1609,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(VM& vm, Depreca
}
// 13.35 ParseTemporalMonthDayString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalmonthdaystring
-ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalMonthDayString).
auto parse_result = parse_iso8601(Production::TemporalMonthDayString, iso_string);
@@ -1639,7 +1639,7 @@ ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(VM& vm, Depr
}
// 13.36 ParseTemporalRelativeToString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring
-ThrowCompletionOr<ISODateTime> parse_temporal_relative_to_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<ISODateTime> parse_temporal_relative_to_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalDateTimeString).
auto parse_result = parse_iso8601(Production::TemporalDateTimeString, iso_string);
@@ -1657,7 +1657,7 @@ ThrowCompletionOr<ISODateTime> parse_temporal_relative_to_string(VM& vm, Depreca
}
// 13.37 ParseTemporalTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring
-ThrowCompletionOr<TemporalTime> parse_temporal_time_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<TemporalTime> parse_temporal_time_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalTimeString).
auto parse_result = parse_iso8601(Production::TemporalTimeString, iso_string);
@@ -1678,7 +1678,7 @@ ThrowCompletionOr<TemporalTime> parse_temporal_time_string(VM& vm, DeprecatedStr
}
// 13.38 ParseTemporalTimeZoneString ( timeZoneString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimezonestring
-ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(VM& vm, DeprecatedString const& time_zone_string)
+ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(VM& vm, StringView time_zone_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(timeZoneString), TimeZoneIdentifier).
auto parse_result = parse_iso8601(Production::TimeZoneIdentifier, time_zone_string);
@@ -1704,7 +1704,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(VM& vm, Depr
}
// 13.39 ParseTemporalYearMonthString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalyearmonthstring
-ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(VM& vm, DeprecatedString const& iso_string)
+ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(VM& vm, StringView iso_string)
{
// 1. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalYearMonthString).
auto parse_result = parse_iso8601(Production::TemporalYearMonthString, iso_string);
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h
index b1d312b176..4a439844d3 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h
@@ -163,17 +163,17 @@ Crypto::SignedBigInteger round_number_to_increment(Crypto::SignedBigInteger cons
Crypto::SignedBigInteger round_number_to_increment_as_if_positive(Crypto::SignedBigInteger const&, u64 increment, StringView rounding_mode);
ThrowCompletionOr<ISODateTime> parse_iso_date_time(VM&, StringView iso_string);
ThrowCompletionOr<ISODateTime> parse_iso_date_time(VM&, ParseResult const& parse_result);
-ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<ISODateTime> parse_temporal_zoned_date_time_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<DeprecatedString> parse_temporal_calendar_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<TemporalDate> parse_temporal_date_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<ISODateTime> parse_temporal_relative_to_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<TemporalTime> parse_temporal_time_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(VM&, DeprecatedString const& iso_string);
-ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(VM&, DeprecatedString const& iso_string);
+ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM&, StringView iso_string);
+ThrowCompletionOr<ISODateTime> parse_temporal_zoned_date_time_string(VM&, StringView iso_string);
+ThrowCompletionOr<DeprecatedString> parse_temporal_calendar_string(VM&, StringView iso_string);
+ThrowCompletionOr<TemporalDate> parse_temporal_date_string(VM&, StringView iso_string);
+ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(VM&, StringView iso_string);
+ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(VM&, StringView iso_string);
+ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(VM&, StringView iso_string);
+ThrowCompletionOr<ISODateTime> parse_temporal_relative_to_string(VM&, StringView iso_string);
+ThrowCompletionOr<TemporalTime> parse_temporal_time_string(VM&, StringView iso_string);
+ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(VM&, StringView iso_string);
+ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(VM&, StringView iso_string);
ThrowCompletionOr<double> to_positive_integer_with_truncation(VM&, Value argument);
ThrowCompletionOr<Object*> prepare_temporal_fields(VM&, Object const& fields, Vector<DeprecatedString> const& field_names, Variant<PrepareTemporalFieldsPartial, Vector<StringView>> const& required_fields);
ThrowCompletionOr<DifferenceSettings> get_difference_settings(VM&, DifferenceOperation, Value options_value, UnitGroup unit_group, Vector<StringView> const& disallowed_units, TemporalUnitDefault const& fallback_smallest_unit, StringView smallest_largest_default_unit);
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
index 0141ea1986..648320da1a 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
@@ -143,7 +143,7 @@ ThrowCompletionOr<DurationRecord> to_temporal_duration_record(VM& vm, Value temp
// 1. If Type(temporalDurationLike) is not Object, then
if (!temporal_duration_like.is_object()) {
// a. Let string be ? ToString(temporalDurationLike).
- auto string = TRY(temporal_duration_like.to_deprecated_string(vm));
+ auto string = TRY(temporal_duration_like.to_string(vm));
// b. Return ? ParseTemporalDurationString(string).
return parse_temporal_duration_string(vm, string);
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
index 2c90d8528e..571ce27dfd 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
@@ -140,7 +140,7 @@ ThrowCompletionOr<PlainDate*> to_temporal_date(VM& vm, Value item, Object const*
(void)TRY(to_temporal_overflow(vm, options));
// 5. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// 6. Let result be ? ParseTemporalDateString(string).
auto result = TRY(parse_temporal_date_string(vm, string));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
index 7a1c059099..c6d26368a4 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
@@ -165,7 +165,7 @@ ThrowCompletionOr<PlainDateTime*> to_temporal_date_time(VM& vm, Value item, Obje
(void)TRY(to_temporal_overflow(vm, options));
// b. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// c. Let result be ? ParseTemporalDateTimeString(string).
result = TRY(parse_temporal_date_time_string(vm, string));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
index 245466e55b..1419943af9 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
@@ -120,7 +120,7 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(VM& vm, Value item, Obje
(void)TRY(to_temporal_overflow(vm, options));
// 6. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// 7. Let result be ? ParseTemporalMonthDayString(string).
auto result = TRY(parse_temporal_month_day_string(vm, string));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
index 8067a64400..5007e374c9 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
@@ -137,7 +137,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(VM& vm, Value item, Optional<Stri
// 4. Else,
else {
// a. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// b. Let result be ? ParseTemporalTimeString(string).
result = TRY(parse_temporal_time_string(vm, string));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
index 1e41aec2dc..e5961d6396 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
@@ -66,7 +66,7 @@ ThrowCompletionOr<PlainYearMonth*> to_temporal_year_month(VM& vm, Value item, Ob
(void)TRY(to_temporal_overflow(vm, options));
// 5. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// 6. Let result be ? ParseTemporalYearMonthString(string).
auto result = TRY(parse_temporal_year_month_string(vm, string));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
index 97acc3770a..d1bf8137e4 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
@@ -332,7 +332,7 @@ ThrowCompletionOr<Object*> to_temporal_time_zone(VM& vm, Value temporal_time_zon
}
// 2. Let identifier be ? ToString(temporalTimeZoneLike).
- auto identifier = TRY(temporal_time_zone_like.to_deprecated_string(vm));
+ auto identifier = TRY(temporal_time_zone_like.to_string(vm));
// 3. Let parseResult be ? ParseTemporalTimeZoneString(identifier).
auto parse_result = TRY(parse_temporal_time_zone_string(vm, identifier));
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
index 42f2e854ff..f7a6c2c6b8 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
@@ -185,7 +185,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
(void)TRY(to_temporal_overflow(vm, options));
// b. Let string be ? ToString(item).
- auto string = TRY(item.to_deprecated_string(vm));
+ auto string = TRY(item.to_string(vm));
// c. Let result be ? ParseTemporalZonedDateTimeString(string).
result = TRY(parse_temporal_zoned_date_time_string(vm, string));