1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibJS: Replace GlobalObject with VM in Temporal AOs [Part 2/19]

This commit is contained in:
Linus Groh 2022-08-20 08:52:42 +01:00
parent f9705eb2f4
commit 694f66b5ca
58 changed files with 1564 additions and 1600 deletions

View file

@ -56,13 +56,13 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
auto requested_locales = TRY(canonicalize_locale_list(vm, locales));
// 4. Let options be ? GetOptionsObject(options).
auto* options = TRY(Temporal::get_options_object(global_object, options_value));
auto* options = TRY(Temporal::get_options_object(vm, options_value));
// 5. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
auto matcher = TRY(get_option(global_object, *options, vm.names.localeMatcher, OptionType::String, { "lookup"sv, "best fit"sv }, "best fit"sv));
auto matcher = TRY(get_option(vm, *options, vm.names.localeMatcher, OptionType::String, { "lookup"sv, "best fit"sv }, "best fit"sv));
// 6. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined).
auto numbering_system = TRY(get_option(global_object, *options, vm.names.numberingSystem, OptionType::String, {}, Empty {}));
auto numbering_system = TRY(get_option(vm, *options, vm.names.numberingSystem, OptionType::String, {}, Empty {}));
// FIXME: Missing spec step - If numberingSystem is not undefined, then
if (!numbering_system.is_undefined()) {
@ -90,7 +90,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
duration_format->set_numbering_system(result.nu.release_value());
// 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow", "digital" », "long").
auto style = TRY(get_option(global_object, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv, "digital"sv }, "long"sv));
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv, "digital"sv }, "long"sv));
// 14. Set durationFormat.[[Style]] to style.
duration_format->set_style(style.as_string().string());