mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:57:35 +00:00
LibJS: Convert ordinary_create_from_constructor() to NonnullGCPtr
This commit is contained in:
parent
22089436ed
commit
1c24b82dd7
39 changed files with 80 additions and 80 deletions
|
@ -171,10 +171,10 @@ ThrowCompletionOr<Object*> CollatorConstructor::construct(FunctionObject& new_ta
|
|||
// a. Append [[CaseFirst]] as the last element of internalSlotsList.
|
||||
|
||||
// 5. Let collator be ? OrdinaryCreateFromConstructor(newTarget, "%Collator.prototype%", internalSlotsList).
|
||||
auto* collator = TRY(ordinary_create_from_constructor<Collator>(vm, new_target, &Intrinsics::intl_collator_prototype));
|
||||
auto collator = TRY(ordinary_create_from_constructor<Collator>(vm, new_target, &Intrinsics::intl_collator_prototype));
|
||||
|
||||
// 6. Return ? InitializeCollator(collator, locales, options).
|
||||
return TRY(initialize_collator(vm, *collator, locales, options));
|
||||
return TRY(initialize_collator(vm, collator, locales, options));
|
||||
}
|
||||
|
||||
// 10.2.2 Intl.Collator.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.collator.supportedlocalesof
|
||||
|
|
|
@ -54,17 +54,17 @@ ThrowCompletionOr<Object*> DateTimeFormatConstructor::construct(FunctionObject&
|
|||
auto options = vm.argument(1);
|
||||
|
||||
// 2. Let dateTimeFormat be ? OrdinaryCreateFromConstructor(newTarget, "%DateTimeFormat.prototype%", « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[Weekday]], [[Era]], [[Year]], [[Month]], [[Day]], [[DayPeriod]], [[Hour]], [[Minute]], [[Second]], [[FractionalSecondDigits]], [[TimeZoneName]], [[HourCycle]], [[Pattern]], [[BoundFormat]] »).
|
||||
auto* date_time_format = TRY(ordinary_create_from_constructor<DateTimeFormat>(vm, new_target, &Intrinsics::intl_date_time_format_prototype));
|
||||
auto date_time_format = TRY(ordinary_create_from_constructor<DateTimeFormat>(vm, new_target, &Intrinsics::intl_date_time_format_prototype));
|
||||
|
||||
// 3. Perform ? InitializeDateTimeFormat(dateTimeFormat, locales, options).
|
||||
TRY(initialize_date_time_format(vm, *date_time_format, locales, options));
|
||||
TRY(initialize_date_time_format(vm, date_time_format, locales, options));
|
||||
|
||||
// 4. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then
|
||||
// a. Let this be the this value.
|
||||
// b. Return ? ChainDateTimeFormat(dateTimeFormat, NewTarget, this).
|
||||
|
||||
// 5. Return dateTimeFormat.
|
||||
return date_time_format;
|
||||
return date_time_format.ptr();
|
||||
}
|
||||
|
||||
// 11.2.2 Intl.DateTimeFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.datetimeformat.supportedlocalesof
|
||||
|
|
|
@ -52,7 +52,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
|
|||
auto options_value = vm.argument(1);
|
||||
|
||||
// 2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNames.prototype%", « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[LanguageDisplay]], [[Fields]] »).
|
||||
auto* display_names = TRY(ordinary_create_from_constructor<DisplayNames>(vm, new_target, &Intrinsics::intl_display_names_prototype));
|
||||
auto display_names = TRY(ordinary_create_from_constructor<DisplayNames>(vm, new_target, &Intrinsics::intl_display_names_prototype));
|
||||
|
||||
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||
auto requested_locales = TRY(canonicalize_locale_list(vm, locale_value));
|
||||
|
@ -130,7 +130,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
|
|||
// 29. Set displayNames.[[Fields]] to styleFields.
|
||||
|
||||
// 30. Return displayNames.
|
||||
return display_names;
|
||||
return display_names.ptr();
|
||||
}
|
||||
|
||||
// 12.2.2 Intl.DisplayNames.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.supportedLocalesOf
|
||||
|
|
|
@ -50,7 +50,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
|
|||
auto options_value = vm.argument(1);
|
||||
|
||||
// 2. Let durationFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%DurationFormatPrototype%", « [[InitializedDurationFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[YearsStyle]], [[YearsDisplay]], [[MonthsStyle]], [[MonthsDisplay]] , [[WeeksStyle]], [[WeeksDisplay]] , [[DaysStyle]], [[DaysDisplay]] , [[HoursStyle]], [[HoursDisplay]] , [[MinutesStyle]], [[MinutesDisplay]] , [[SecondsStyle]], [[SecondsDisplay]] , [[MillisecondsStyle]], [[MillisecondsDisplay]] , [[MicrosecondsStyle]], [[MicrosecondsDisplay]] , [[NanosecondsStyle]], [[NanosecondsDisplay]], [[FractionalDigits]] »).
|
||||
auto* duration_format = TRY(ordinary_create_from_constructor<DurationFormat>(vm, new_target, &Intrinsics::intl_duration_format_prototype));
|
||||
auto duration_format = TRY(ordinary_create_from_constructor<DurationFormat>(vm, new_target, &Intrinsics::intl_duration_format_prototype));
|
||||
|
||||
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||
auto requested_locales = TRY(canonicalize_locale_list(vm, locales));
|
||||
|
@ -138,7 +138,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
|
|||
duration_format->set_fractional_digits(Optional<u8>(TRY(get_number_option(vm, *options, vm.names.fractionalDigits, 0, 9, 0))));
|
||||
|
||||
// 19. Return durationFormat.
|
||||
return duration_format;
|
||||
return duration_format.ptr();
|
||||
}
|
||||
|
||||
// 1.3.2 Intl.DurationFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.supportedLocalesOf
|
||||
|
|
|
@ -51,7 +51,7 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_
|
|||
auto options_value = vm.argument(1);
|
||||
|
||||
// 2. Let listFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%ListFormat.prototype%", « [[InitializedListFormat]], [[Locale]], [[Type]], [[Style]], [[Templates]] »).
|
||||
auto* list_format = TRY(ordinary_create_from_constructor<ListFormat>(vm, new_target, &Intrinsics::intl_list_format_prototype));
|
||||
auto list_format = TRY(ordinary_create_from_constructor<ListFormat>(vm, new_target, &Intrinsics::intl_list_format_prototype));
|
||||
|
||||
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||
auto requested_locales = TRY(canonicalize_locale_list(vm, locale_value));
|
||||
|
@ -91,7 +91,7 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_
|
|||
// Note: The remaining steps are skipped in favor of deferring to LibUnicode.
|
||||
|
||||
// 19. Return listFormat.
|
||||
return list_format;
|
||||
return list_format.ptr();
|
||||
}
|
||||
|
||||
// 13.2.2 Intl.ListFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.ListFormat.supportedLocalesOf
|
||||
|
|
|
@ -258,7 +258,7 @@ ThrowCompletionOr<Object*> LocaleConstructor::construct(FunctionObject& new_targ
|
|||
// a. Append [[Numeric]] as the last element of internalSlotsList.
|
||||
|
||||
// 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, "%Locale.prototype%", internalSlotsList).
|
||||
auto* locale = TRY(ordinary_create_from_constructor<Locale>(vm, new_target, &Intrinsics::intl_locale_prototype));
|
||||
auto locale = TRY(ordinary_create_from_constructor<Locale>(vm, new_target, &Intrinsics::intl_locale_prototype));
|
||||
|
||||
DeprecatedString tag;
|
||||
|
||||
|
@ -362,7 +362,7 @@ ThrowCompletionOr<Object*> LocaleConstructor::construct(FunctionObject& new_targ
|
|||
locale->set_numbering_system(result.nu.release_value());
|
||||
|
||||
// 37. Return locale.
|
||||
return locale;
|
||||
return locale.ptr();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,17 +50,17 @@ ThrowCompletionOr<Object*> NumberFormatConstructor::construct(FunctionObject& ne
|
|||
auto options = vm.argument(1);
|
||||
|
||||
// 2. Let numberFormat be ? OrdinaryCreateFromConstructor(newTarget, "%NumberFormat.prototype%", « [[InitializedNumberFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[Unit]], [[UnitDisplay]], [[Currency]], [[CurrencyDisplay]], [[CurrencySign]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[Notation]], [[CompactDisplay]], [[UseGrouping]], [[SignDisplay]], [[BoundFormat]] »).
|
||||
auto* number_format = TRY(ordinary_create_from_constructor<NumberFormat>(vm, new_target, &Intrinsics::intl_number_format_prototype));
|
||||
auto number_format = TRY(ordinary_create_from_constructor<NumberFormat>(vm, new_target, &Intrinsics::intl_number_format_prototype));
|
||||
|
||||
// 3. Perform ? InitializeNumberFormat(numberFormat, locales, options).
|
||||
TRY(initialize_number_format(vm, *number_format, locales, options));
|
||||
TRY(initialize_number_format(vm, number_format, locales, options));
|
||||
|
||||
// 4. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then
|
||||
// a. Let this be the this value.
|
||||
// b. Return ? ChainNumberFormat(numberFormat, NewTarget, this).
|
||||
|
||||
// 5. Return numberFormat.
|
||||
return number_format;
|
||||
return number_format.ptr();
|
||||
}
|
||||
|
||||
// 15.2.2 Intl.NumberFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.numberformat.supportedlocalesof
|
||||
|
|
|
@ -51,10 +51,10 @@ ThrowCompletionOr<Object*> PluralRulesConstructor::construct(FunctionObject& new
|
|||
auto options = vm.argument(1);
|
||||
|
||||
// 2. Let pluralRules be ? OrdinaryCreateFromConstructor(NewTarget, "%PluralRules.prototype%", « [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]] »).
|
||||
auto* plural_rules = TRY(ordinary_create_from_constructor<PluralRules>(vm, new_target, &Intrinsics::intl_plural_rules_prototype));
|
||||
auto plural_rules = TRY(ordinary_create_from_constructor<PluralRules>(vm, new_target, &Intrinsics::intl_plural_rules_prototype));
|
||||
|
||||
// 3. Return ? InitializePluralRules(pluralRules, locales, options).
|
||||
return TRY(initialize_plural_rules(vm, *plural_rules, locales, options));
|
||||
return TRY(initialize_plural_rules(vm, plural_rules, locales, options));
|
||||
}
|
||||
|
||||
// 16.2.2 Intl.PluralRules.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.pluralrules.supportedlocalesof
|
||||
|
|
|
@ -54,10 +54,10 @@ ThrowCompletionOr<Object*> RelativeTimeFormatConstructor::construct(FunctionObje
|
|||
auto options = vm.argument(1);
|
||||
|
||||
// 2. Let relativeTimeFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%RelativeTimeFormat.prototype%", « [[InitializedRelativeTimeFormat]], [[Locale]], [[DataLocale]], [[Style]], [[Numeric]], [[NumberFormat]], [[NumberingSystem]], [[PluralRules]] »).
|
||||
auto* relative_time_format = TRY(ordinary_create_from_constructor<RelativeTimeFormat>(vm, new_target, &Intrinsics::intl_relative_time_format_prototype));
|
||||
auto relative_time_format = TRY(ordinary_create_from_constructor<RelativeTimeFormat>(vm, new_target, &Intrinsics::intl_relative_time_format_prototype));
|
||||
|
||||
// 3. Return ? InitializeRelativeTimeFormat(relativeTimeFormat, locales, options).
|
||||
return TRY(initialize_relative_time_format(vm, *relative_time_format, locales, options));
|
||||
return TRY(initialize_relative_time_format(vm, relative_time_format, locales, options));
|
||||
}
|
||||
|
||||
// 17.2.2 Intl.RelativeTimeFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf
|
||||
|
|
|
@ -51,7 +51,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t
|
|||
|
||||
// 2. Let internalSlotsList be « [[InitializedSegmenter]], [[Locale]], [[SegmenterGranularity]] ».
|
||||
// 3. Let segmenter be ? OrdinaryCreateFromConstructor(NewTarget, "%Segmenter.prototype%", internalSlotsList).
|
||||
auto* segmenter = TRY(ordinary_create_from_constructor<Segmenter>(vm, new_target, &Intrinsics::intl_segmenter_prototype));
|
||||
auto segmenter = TRY(ordinary_create_from_constructor<Segmenter>(vm, new_target, &Intrinsics::intl_segmenter_prototype));
|
||||
|
||||
// 4. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||
auto requested_locales = TRY(canonicalize_locale_list(vm, locales));
|
||||
|
@ -83,7 +83,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t
|
|||
segmenter->set_segmenter_granularity(granularity.as_string().deprecated_string());
|
||||
|
||||
// 14. Return segmenter.
|
||||
return segmenter;
|
||||
return segmenter.ptr();
|
||||
}
|
||||
|
||||
// 18.2.2 Intl.Segmenter.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.segmenter.supportedlocalesof
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue