mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibJS: Convert standalone construct() to NonnullGCPtr
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 20:19:08 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/bd40464195 Pull-request: https://github.com/SerenityOS/serenity/pull/16498 Reviewed-by: https://github.com/trflynn89 ✅
@@ -437,7 +437,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
||||
// i. If style is "2-digit" or "numeric", then
|
||||
if (style == DurationFormat::ValueStyle::TwoDigit || style == DurationFormat::ValueStyle::Numeric) {
|
||||
// 1. Let nf be ! Construct(%NumberFormat%, « durationFormat.[[Locale]], nfOpts »).
|
||||
auto* number_format = static_cast<NumberFormat*>(MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), number_format_options)));
|
||||
auto* number_format = static_cast<NumberFormat*>(MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), number_format_options)).ptr());
|
||||
|
||||
// 2. Let dataLocale be durationFormat.[[DataLocale]].
|
||||
auto const& data_locale = duration_format.data_locale();
|
||||
@@ -501,7 +501,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
||||
MUST(number_format_options->create_data_property_or_throw(vm.names.unitDisplay, PrimitiveString::create(vm, unicode_style)));
|
||||
|
||||
// 4. Let nf be ! Construct(%NumberFormat%, « durationFormat.[[Locale]], nfOpts »).
|
||||
auto* number_format = static_cast<NumberFormat*>(MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), number_format_options)));
|
||||
auto* number_format = static_cast<NumberFormat*>(MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), number_format_options)).ptr());
|
||||
|
||||
// 5. Let parts be ! PartitionNumberPattern(nf, 𝔽(value)).
|
||||
auto parts = partition_number_pattern(vm, *number_format, MathematicalValue(value));
|
||||
@@ -542,7 +542,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
||||
MUST(list_format_options->create_data_property_or_throw(vm.names.style, PrimitiveString::create(vm, unicode_list_style)));
|
||||
|
||||
// 9. Let lf be ! Construct(%ListFormat%, « durationFormat.[[Locale]], lfOpts »).
|
||||
auto* list_format = static_cast<ListFormat*>(MUST(construct(vm, *realm.intrinsics().intl_list_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), list_format_options)));
|
||||
auto* list_format = static_cast<ListFormat*>(MUST(construct(vm, *realm.intrinsics().intl_list_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), list_format_options)).ptr());
|
||||
|
||||
// FIXME: CreatePartsFromList expects a list of strings and creates a list of Pattern Partition records, but we already created a list of Pattern Partition records
|
||||
// so we try to hack something together from it that looks mostly right
|
||||
|
||||
Reference in New Issue
Block a user