mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:57:35 +00:00
LibJS: Convert Object::create() to NonnullGCPtr
This commit is contained in:
parent
f990095728
commit
ddc6e139a6
45 changed files with 80 additions and 80 deletions
|
@ -600,7 +600,7 @@ ThrowCompletionOr<Object*> coerce_options_to_object(VM& vm, Value options)
|
|||
// 1. If options is undefined, then
|
||||
if (options.is_undefined()) {
|
||||
// a. Return OrdinaryObjectCreate(null).
|
||||
return Object::create(realm, nullptr);
|
||||
return Object::create(realm, nullptr).ptr();
|
||||
}
|
||||
|
||||
// 2. Return ? ToObject(options).
|
||||
|
|
|
@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(CollatorPrototype::resolved_options)
|
|||
auto* collator = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 3, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -547,13 +547,13 @@ ThrowCompletionOr<Vector<PatternPartition>> format_date_time_pattern(VM& vm, Dat
|
|||
auto const& locale = date_time_format.locale();
|
||||
auto const& data_locale = date_time_format.data_locale();
|
||||
|
||||
auto construct_number_format = [&](auto* options) -> ThrowCompletionOr<NumberFormat*> {
|
||||
auto construct_number_format = [&](auto& options) -> ThrowCompletionOr<NumberFormat*> {
|
||||
auto* number_format = TRY(construct(vm, *realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, locale), options));
|
||||
return static_cast<NumberFormat*>(number_format);
|
||||
};
|
||||
|
||||
// 4. Let nfOptions be OrdinaryObjectCreate(null).
|
||||
auto* number_format_options = Object::create(realm, nullptr);
|
||||
auto number_format_options = Object::create(realm, nullptr);
|
||||
|
||||
// 5. Perform ! CreateDataPropertyOrThrow(nfOptions, "useGrouping", false).
|
||||
MUST(number_format_options->create_data_property_or_throw(vm.names.useGrouping, Value(false)));
|
||||
|
@ -562,7 +562,7 @@ ThrowCompletionOr<Vector<PatternPartition>> format_date_time_pattern(VM& vm, Dat
|
|||
auto* number_format = TRY(construct_number_format(number_format_options));
|
||||
|
||||
// 7. Let nf2Options be OrdinaryObjectCreate(null).
|
||||
auto* number_format_options2 = Object::create(realm, nullptr);
|
||||
auto number_format_options2 = Object::create(realm, nullptr);
|
||||
|
||||
// 8. Perform ! CreateDataPropertyOrThrow(nf2Options, "minimumIntegerDigits", 2).
|
||||
MUST(number_format_options2->create_data_property_or_throw(vm.names.minimumIntegerDigits, Value(2)));
|
||||
|
@ -582,7 +582,7 @@ ThrowCompletionOr<Vector<PatternPartition>> format_date_time_pattern(VM& vm, Dat
|
|||
fractional_second_digits = date_time_format.fractional_second_digits();
|
||||
|
||||
// a. Let nf3Options be OrdinaryObjectCreate(null).
|
||||
auto* number_format_options3 = Object::create(realm, nullptr);
|
||||
auto number_format_options3 = Object::create(realm, nullptr);
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(nf3Options, "minimumIntegerDigits", fractionalSecondDigits).
|
||||
MUST(number_format_options3->create_data_property_or_throw(vm.names.minimumIntegerDigits, Value(*fractional_second_digits)));
|
||||
|
@ -865,7 +865,7 @@ ThrowCompletionOr<Array*> format_date_time_to_parts(VM& vm, DateTimeFormat& date
|
|||
// 4. For each Record { [[Type]], [[Value]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
@ -1181,7 +1181,7 @@ ThrowCompletionOr<Array*> format_date_time_range_to_parts(VM& vm, DateTimeFormat
|
|||
// 4. For each Record { [[Type]], [[Value]], [[Source]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%ObjectPrototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
|
|
@ -155,7 +155,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::resolved_options)
|
|||
auto* date_time_format = TRY(typed_this_object(vm));
|
||||
|
||||
// 4. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 5. For each row of Table 5, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -131,7 +131,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::resolved_options)
|
|||
auto* display_names = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 8, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -339,7 +339,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
|||
auto value = duration.*value_slot;
|
||||
|
||||
// i. Let nfOpts be ! OrdinaryObjectCreate(null).
|
||||
auto* number_format_options = Object::create(realm, nullptr);
|
||||
auto number_format_options = Object::create(realm, nullptr);
|
||||
|
||||
// j. If unit is "seconds", "milliseconds", or "microseconds", then
|
||||
if (unit.is_one_of("seconds"sv, "milliseconds"sv, "microseconds"sv)) {
|
||||
|
@ -486,7 +486,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
|||
}
|
||||
|
||||
// 4. Let lfOpts be ! OrdinaryObjectCreate(null).
|
||||
auto* list_format_options = Object::create(realm, nullptr);
|
||||
auto list_format_options = Object::create(realm, nullptr);
|
||||
|
||||
// 5. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
|
||||
MUST(list_format_options->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, "unit"sv)));
|
||||
|
|
|
@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format_to_parts)
|
|||
auto const& part = parts[n];
|
||||
|
||||
// a. Let obj be ! OrdinaryObjectCreate(%ObjectPrototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(obj, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::resolved_options)
|
|||
auto* duration_format = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be ! OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 2, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -217,7 +217,7 @@ Array* format_list_to_parts(VM& vm, ListFormat const& list_format, Vector<Deprec
|
|||
// 4. For each Record { [[Type]], [[Value]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
|
|
@ -76,7 +76,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::resolved_options)
|
|||
auto* list_format = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 10, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -258,7 +258,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::text_info)
|
|||
auto* locale_object = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let info be ! ObjectCreate(%Object.prototype%).
|
||||
auto* info = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto info = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. Let dir be ! CharacterDirectionOfLocale(loc).
|
||||
auto direction = character_direction_of_locale(*locale_object);
|
||||
|
@ -280,7 +280,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::week_info)
|
|||
[[maybe_unused]] auto* locale_object = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let info be ! ObjectCreate(%Object.prototype%).
|
||||
auto* info = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto info = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. Let wi be ! WeekInfoOfLocale(loc).
|
||||
auto week_info = week_info_of_locale(*locale_object);
|
||||
|
|
|
@ -922,7 +922,7 @@ Array* format_numeric_to_parts(VM& vm, NumberFormat& number_format, Mathematical
|
|||
// 4. For each Record { [[Type]], [[Value]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
@ -1832,7 +1832,7 @@ ThrowCompletionOr<Array*> format_numeric_range_to_parts(VM& vm, NumberFormat& nu
|
|||
// 4. For each Record { [[Type]], [[Value]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
|
|
@ -145,7 +145,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::resolved_options)
|
|||
auto* number_format = TRY(typed_this_object(vm));
|
||||
|
||||
// 4. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 5. For each row of Table 11, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -86,7 +86,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::resolved_options)
|
|||
auto* plural_rules = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 13, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -257,7 +257,7 @@ ThrowCompletionOr<Array*> format_relative_time_to_parts(VM& vm, RelativeTimeForm
|
|||
// 4. For each Record { [[Type]], [[Value]], [[Unit]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
|
||||
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
|
||||
|
|
|
@ -76,7 +76,7 @@ JS_DEFINE_NATIVE_FUNCTION(RelativeTimeFormatPrototype::resolved_options)
|
|||
auto* relative_time_format = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 15, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
|
@ -62,7 +62,7 @@ Object* create_segment_data_object(VM& vm, Segmenter const& segmenter, Utf16View
|
|||
VERIFY(start_index < end_index);
|
||||
|
||||
// 5. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* result = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto result = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 6. Let segment be the substring of string from startIndex to endIndex.
|
||||
auto segment = string.substring_view(start_index, end_index - start_index);
|
||||
|
|
|
@ -41,7 +41,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmenterPrototype::resolved_options)
|
|||
auto* segmenter = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
// 4. For each row of Table 16, except the header row, in table order, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue