From ec9f2013c9807432826e813a51cae3a943f215b4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 26 Jan 2023 12:09:01 +0000 Subject: [PATCH] LibJS: Port to_temporal_disambiguation() to String --- .../Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 6 +++--- .../Libraries/LibJS/Runtime/Temporal/AbstractOperations.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 7cf0c30161..d3c44229bf 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -170,17 +170,17 @@ ThrowCompletionOr to_temporal_overflow(VM& vm, Object const* options) } // 13.5 ToTemporalDisambiguation ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation -ThrowCompletionOr to_temporal_disambiguation(VM& vm, Object const* options) +ThrowCompletionOr to_temporal_disambiguation(VM& vm, Object const* options) { // 1. If options is undefined, return "compatible". if (options == nullptr) - return "compatible"sv; + return TRY_OR_THROW_OOM(vm, String::from_utf8("compatible"sv)); // 2. Return ? GetOption(options, "disambiguation", "string", « "compatible", "earlier", "later", "reject" », "compatible"). auto option = TRY(get_option(vm, *options, vm.names.disambiguation, OptionType::String, { "compatible"sv, "earlier"sv, "later"sv, "reject"sv }, "compatible"sv)); VERIFY(option.is_string()); - return TRY(option.as_string().deprecated_string()); + return option.as_string().utf8_string(); } // 13.6 ToTemporalRoundingMode ( normalizedOptions, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index 3000fcec48..3fc8d9572b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -136,7 +136,7 @@ ThrowCompletionOr> iterable_to_list_of_type(VM&, Value items ThrowCompletionOr get_options_object(VM&, Value options); ThrowCompletionOr get_option(VM&, Object const& options, PropertyKey const& property, OptionType type, Span values, OptionDefault const&); ThrowCompletionOr to_temporal_overflow(VM&, Object const* options); -ThrowCompletionOr to_temporal_disambiguation(VM&, Object const* options); +ThrowCompletionOr to_temporal_disambiguation(VM&, Object const* options); ThrowCompletionOr to_temporal_rounding_mode(VM&, Object const& normalized_options, DeprecatedString const& fallback); StringView negate_temporal_rounding_mode(DeprecatedString const& rounding_mode); ThrowCompletionOr to_temporal_offset(VM&, Object const* options, DeprecatedString const& fallback);