1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:37:35 +00:00

LibJS: Convert Array::create{,_from}() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:49 +00:00
parent 0c50751c13
commit 91b0123eaf
25 changed files with 60 additions and 60 deletions

View file

@ -589,7 +589,7 @@ ThrowCompletionOr<Array*> supported_locales(VM& vm, Vector<DeprecatedString> con
}
// 5. Return CreateArrayFromList(supportedLocales).
return Array::create_from<DeprecatedString>(realm, supported_locales, [&vm](auto& locale) { return PrimitiveString::create(vm, locale); });
return Array::create_from<DeprecatedString>(realm, supported_locales, [&vm](auto& locale) { return PrimitiveString::create(vm, locale); }).ptr();
}
// 9.2.12 CoerceOptionsToObject ( options ), https://tc39.es/ecma402/#sec-coerceoptionstoobject

View file

@ -857,7 +857,7 @@ ThrowCompletionOr<Array*> format_date_time_to_parts(VM& vm, DateTimeFormat& date
auto parts = TRY(partition_date_time_pattern(vm, date_time_format, time));
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;
@ -881,7 +881,7 @@ ThrowCompletionOr<Array*> format_date_time_to_parts(VM& vm, DateTimeFormat& date
}
// 5. Return result.
return result;
return result.ptr();
}
template<typename Callback>
@ -1173,7 +1173,7 @@ ThrowCompletionOr<Array*> format_date_time_range_to_parts(VM& vm, DateTimeFormat
auto parts = TRY(partition_date_time_range_pattern(vm, date_time_format, start, end));
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;
@ -1200,7 +1200,7 @@ ThrowCompletionOr<Array*> format_date_time_range_to_parts(VM& vm, DateTimeFormat
}
// 5. Return result.
return result;
return result.ptr();
}
// 11.5.13 ToLocalTime ( epochNs, calendar, timeZone ), https://tc39.es/ecma402/#sec-tolocaltime

View file

@ -82,7 +82,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format_to_parts)
auto parts = partition_duration_format_pattern(vm, *duration_format, record);
// 6. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 7. Let n be 0.
// 8. For each { [[Type]], [[Value]] } part in parts, do

View file

@ -209,7 +209,7 @@ Array* format_list_to_parts(VM& vm, ListFormat const& list_format, Vector<Deprec
auto parts = create_parts_from_list(list_format, list);
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;

View file

@ -914,7 +914,7 @@ Array* format_numeric_to_parts(VM& vm, NumberFormat& number_format, Mathematical
auto parts = partition_number_pattern(vm, number_format, move(number));
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;
@ -1824,7 +1824,7 @@ ThrowCompletionOr<Array*> format_numeric_range_to_parts(VM& vm, NumberFormat& nu
auto parts = TRY(partition_number_range_pattern(vm, number_format, move(start), move(end)));
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;
@ -1851,7 +1851,7 @@ ThrowCompletionOr<Array*> format_numeric_range_to_parts(VM& vm, NumberFormat& nu
}
// 5. Return result.
return result;
return result.ptr();
}
}

View file

@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::resolved_options)
// 5. Let pluralCategories be a List of Strings containing all possible results of PluralRuleSelect for the selected locale pr.[[Locale]].
auto available_categories = ::Locale::available_plural_categories(plural_rules->locale(), plural_rules->type());
auto* plural_categories = Array::create_from<::Locale::PluralCategory>(realm, available_categories, [&](auto category) {
auto plural_categories = Array::create_from<::Locale::PluralCategory>(realm, available_categories, [&](auto category) {
return PrimitiveString::create(vm, ::Locale::plural_category_to_string(category));
});

View file

@ -249,7 +249,7 @@ ThrowCompletionOr<Array*> format_relative_time_to_parts(VM& vm, RelativeTimeForm
auto parts = TRY(partition_relative_time_pattern(vm, relative_time_format, value, unit));
// 2. Let result be ! ArrayCreate(0).
auto* result = MUST(Array::create(realm, 0));
auto result = MUST(Array::create(realm, 0));
// 3. Let n be 0.
size_t n = 0;
@ -279,7 +279,7 @@ ThrowCompletionOr<Array*> format_relative_time_to_parts(VM& vm, RelativeTimeForm
}
// 5. Return result.
return result;
return result.ptr();
}
}