diff options
author | Linus Groh <mail@linusgroh.de> | 2021-11-08 18:59:10 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-11-08 19:12:47 +0000 |
commit | 46d7c340283fa357e735aaf682878db8f6a47729 (patch) | |
tree | 962f34bec9a15262a1a8338cb1d7d78ecb455983 /Userland/Libraries/LibJS | |
parent | 22562b4b173c07900d17c9e23badbaeffed98137 (diff) | |
download | serenity-46d7c340283fa357e735aaf682878db8f6a47729.zip |
LibJS: Use StringView literals in prepare_temporal_fields()
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 462239e7ac..fa66b72850 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -1234,7 +1234,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, } // ii. If property is in the Property column of Table 13, then // NOTE: The other properties in the table are automatically handled as their default value is undefined - if (property.is_one_of("hour", "minute", "second", "millisecond", "microsecond", "nanosecond")) { + if (property.is_one_of("hour"sv, "minute"sv, "second"sv, "millisecond"sv, "microsecond"sv, "nanosecond"sv)) { // 1. Set value to the corresponding Default value of the same row. value = Value(0); } @@ -1244,13 +1244,12 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, // i. If property is in the Property column of Table 13 and there is a Conversion value in the same row, then // 1. Let Conversion represent the abstract operation named by the Conversion value of the same row. // 2. Set value to ? Conversion(value). - if (property.is_one_of("year", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "eraYear")) { + if (property.is_one_of("year"sv, "hour"sv, "minute"sv, "second"sv, "millisecond"sv, "microsecond"sv, "nanosecond"sv, "eraYear"sv)) value = Value(TRY(to_integer_throw_on_infinity(global_object, value, ErrorType::TemporalPropertyMustBeFinite))); - } else if (property.is_one_of("month", "day")) { + else if (property.is_one_of("month"sv, "day"sv)) value = Value(TRY(to_positive_integer(global_object, value))); - } else if (property.is_one_of("monthCode", "offset", "era")) { + else if (property.is_one_of("monthCode"sv, "offset"sv, "era"sv)) value = TRY(value.to_primitive_string(global_object)); - } } // d. Perform ! CreateDataPropertyOrThrow(result, property, value). |