1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:07:45 +00:00

LibJS: Make Cell::initialize() return void

Stop worrying about tiny OOMs.

Work towards #20405
This commit is contained in:
Andreas Kling 2023-08-07 08:41:28 +02:00
parent fde26c53f0
commit 18c54d8d40
804 changed files with 1330 additions and 2171 deletions

View file

@ -22,13 +22,11 @@ CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collato
{
}
ThrowCompletionOr<void> CollatorCompareFunction::initialize(Realm&)
void CollatorCompareFunction::initialize(Realm&)
{
auto& vm = this->vm();
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable);
return {};
}
// 10.3.3.2 CompareStrings ( collator, x, y ), https://tc39.es/ecma402/#sec-collator-comparestrings

View file

@ -16,7 +16,7 @@ class CollatorCompareFunction : public NativeFunction {
public:
static NonnullGCPtr<CollatorCompareFunction> create(Realm&, Collator&);
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~CollatorCompareFunction() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -135,9 +135,9 @@ CollatorConstructor::CollatorConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> CollatorConstructor::initialize(Realm& realm)
void CollatorConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -147,8 +147,6 @@ ThrowCompletionOr<void> CollatorConstructor::initialize(Realm& realm)
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
return {};
}
// 10.1.1 Intl.Collator ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.collator

View file

@ -14,7 +14,7 @@ class CollatorConstructor final : public NativeFunction {
JS_OBJECT(CollatorConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~CollatorConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -17,20 +17,18 @@ CollatorPrototype::CollatorPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> CollatorPrototype::initialize(Realm& realm)
void CollatorPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Object::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 10.3.2 Intl.Collator.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.collator.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_accessor(realm, vm.names.compare, compare_getter, {}, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 10.3.3 get Intl.Collator.prototype.compare, https://tc39.es/ecma402/#sec-intl.collator.prototype.compare

View file

@ -15,7 +15,7 @@ class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collat
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~CollatorPrototype() override = default;
private:

View file

@ -23,9 +23,9 @@ DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> DateTimeFormatConstructor::initialize(Realm& realm)
void DateTimeFormatConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -36,8 +36,6 @@ ThrowCompletionOr<void> DateTimeFormatConstructor::initialize(Realm& realm)
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
return {};
}
// 11.1.1 Intl.DateTimeFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.datetimeformat

View file

@ -14,7 +14,7 @@ class DateTimeFormatConstructor final : public NativeFunction {
JS_OBJECT(DateTimeFormatConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DateTimeFormatConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -25,15 +25,13 @@ DateTimeFormatFunction::DateTimeFormatFunction(DateTimeFormat& date_time_format,
{
}
ThrowCompletionOr<void> DateTimeFormatFunction::initialize(Realm& realm)
void DateTimeFormatFunction::initialize(Realm& realm)
{
auto& vm = this->vm();
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable);
return {};
}
ThrowCompletionOr<Value> DateTimeFormatFunction::call()

View file

@ -19,7 +19,7 @@ public:
static NonnullGCPtr<DateTimeFormatFunction> create(Realm&, DateTimeFormat&);
virtual ~DateTimeFormatFunction() override = default;
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -19,14 +19,14 @@ DateTimeFormatPrototype::DateTimeFormatPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> DateTimeFormatPrototype::initialize(Realm& realm)
void DateTimeFormatPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 11.3.2 Intl.DateTimeFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DateTimeFormat"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.DateTimeFormat"sv)), Attribute::Configurable);
define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable);
@ -35,8 +35,6 @@ ThrowCompletionOr<void> DateTimeFormatPrototype::initialize(Realm& realm)
define_native_function(realm, vm.names.formatRange, format_range, 2, attr);
define_native_function(realm, vm.names.formatRangeToParts, format_range_to_parts, 2, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 11.3.3 get Intl.DateTimeFormat.prototype.format, https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype.format

View file

@ -15,7 +15,7 @@ class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatProto
JS_PROTOTYPE_OBJECT(DateTimeFormatPrototype, DateTimeFormat, Intl.DateTimeFormat);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DateTimeFormatPrototype() override = default;
private:

View file

@ -21,9 +21,9 @@ DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> DisplayNamesConstructor::initialize(Realm& realm)
void DisplayNamesConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -34,8 +34,6 @@ ThrowCompletionOr<void> DisplayNamesConstructor::initialize(Realm& realm)
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
return {};
}
// 12.1.1 Intl.DisplayNames ( locales, options ), https://tc39.es/ecma402/#sec-Intl.DisplayNames

View file

@ -14,7 +14,7 @@ class DisplayNamesConstructor final : public NativeFunction {
JS_OBJECT(DisplayNamesConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DisplayNamesConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -19,20 +19,18 @@ DisplayNamesPrototype::DisplayNamesPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> DisplayNamesPrototype::initialize(Realm& realm)
void DisplayNamesPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 12.3.2 Intl.DisplayNames.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DisplayNames"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.DisplayNames"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.of, of, 1, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 12.3.3 Intl.DisplayNames.prototype.of ( code ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of

View file

@ -15,7 +15,7 @@ class DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype
JS_PROTOTYPE_OBJECT(DisplayNamesPrototype, DisplayNames, Intl.DisplayNames);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DisplayNamesPrototype() override = default;
private:

View file

@ -20,9 +20,9 @@ DurationFormatConstructor::DurationFormatConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> DurationFormatConstructor::initialize(Realm& realm)
void DurationFormatConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -32,8 +32,6 @@ ThrowCompletionOr<void> DurationFormatConstructor::initialize(Realm& realm)
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
return {};
}
// 1.2.1 Intl.DurationFormat ( [ locales [ , options ] ] ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat

View file

@ -14,7 +14,7 @@ class DurationFormatConstructor final : public NativeFunction {
JS_OBJECT(DurationFormatConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DurationFormatConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -18,21 +18,19 @@ DurationFormatPrototype::DurationFormatPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> DurationFormatPrototype::initialize(Realm& realm)
void DurationFormatPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 1.4.2 Intl.DurationFormat.prototype [ @@toStringTag ], https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DurationFormat"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.DurationFormat"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.format, format, 1, attr);
define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 1.4.3 Intl.DurationFormat.prototype.format ( duration ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.format

View file

@ -15,7 +15,7 @@ class DurationFormatPrototype final : public PrototypeObject<DurationFormatProto
JS_PROTOTYPE_OBJECT(DurationFormatPrototype, DurationFormat, Intl.DurationFormat);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~DurationFormatPrototype() override = default;
private:

View file

@ -32,14 +32,14 @@ Intl::Intl(Realm& realm)
{
}
ThrowCompletionOr<void> Intl::initialize(Realm& realm)
void Intl::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Object::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 8.1.1 Intl[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl-toStringTag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_intrinsic_accessor(vm.names.Collator, attr, [](auto& realm) -> Value { return realm.intrinsics().intl_collator_constructor(); });
@ -55,8 +55,6 @@ ThrowCompletionOr<void> Intl::initialize(Realm& realm)
define_native_function(realm, vm.names.getCanonicalLocales, get_canonical_locales, 1, attr);
define_native_function(realm, vm.names.supportedValuesOf, supported_values_of, 1, attr);
return {};
}
// 8.3.1 Intl.getCanonicalLocales ( locales ), https://tc39.es/ecma402/#sec-intl.getcanonicallocales

View file

@ -14,7 +14,7 @@ class Intl final : public Object {
JS_OBJECT(Intl, Object);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~Intl() override = default;
private:

View file

@ -20,9 +20,9 @@ ListFormatConstructor::ListFormatConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> ListFormatConstructor::initialize(Realm& realm)
void ListFormatConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -33,8 +33,6 @@ ThrowCompletionOr<void> ListFormatConstructor::initialize(Realm& realm)
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
return {};
}
// 13.1.1 Intl.ListFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-Intl.ListFormat

View file

@ -14,7 +14,7 @@ class ListFormatConstructor final : public NativeFunction {
JS_OBJECT(ListFormatConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~ListFormatConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -18,21 +18,19 @@ ListFormatPrototype::ListFormatPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> ListFormatPrototype::initialize(Realm& realm)
void ListFormatPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 13.3.2 Intl.ListFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype-toStringTag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.ListFormat"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.ListFormat"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.format, format, 1, attr);
define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 13.3.3 Intl.ListFormat.prototype.format ( list ), https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype.format

View file

@ -15,7 +15,7 @@ class ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, Li
JS_PROTOTYPE_OBJECT(ListFormatPrototype, ListFormat, Intl.ListFormat);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~ListFormatPrototype() override = default;
private:

View file

@ -222,17 +222,15 @@ LocaleConstructor::LocaleConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> LocaleConstructor::initialize(Realm& realm)
void LocaleConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 14.2.1 Intl.Locale.prototype, https://tc39.es/ecma402/#sec-Intl.Locale.prototype
define_direct_property(vm.names.prototype, realm.intrinsics().intl_locale_prototype(), 0);
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
return {};
}
// 14.1.1 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale

View file

@ -14,7 +14,7 @@ class LocaleConstructor final : public NativeFunction {
JS_OBJECT(LocaleConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~LocaleConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -19,9 +19,9 @@ LocalePrototype::LocalePrototype(Realm& realm)
{
}
ThrowCompletionOr<void> LocalePrototype::initialize(Realm& realm)
void LocalePrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -31,7 +31,7 @@ ThrowCompletionOr<void> LocalePrototype::initialize(Realm& realm)
define_native_function(realm, vm.names.toString, to_string, 0, attr);
// 14.3.2 Intl.Locale.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.Locale.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Locale"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.Locale"sv)), Attribute::Configurable);
define_native_accessor(realm, vm.names.baseName, base_name, {}, Attribute::Configurable);
define_native_accessor(realm, vm.names.calendar, calendar, {}, Attribute::Configurable);
@ -50,8 +50,6 @@ ThrowCompletionOr<void> LocalePrototype::initialize(Realm& realm)
define_native_accessor(realm, vm.names.timeZones, time_zones, {}, Attribute::Configurable);
define_native_accessor(realm, vm.names.textInfo, text_info, {}, Attribute::Configurable);
define_native_accessor(realm, vm.names.weekInfo, week_info, {}, Attribute::Configurable);
return {};
}
// 14.3.3 Intl.Locale.prototype.maximize ( ), https://tc39.es/ecma402/#sec-Intl.Locale.prototype.maximize

View file

@ -15,7 +15,7 @@ class LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
JS_PROTOTYPE_OBJECT(LocalePrototype, Locale, Intl.Locale);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~LocalePrototype() override = default;
private:

View file

@ -19,9 +19,9 @@ NumberFormatConstructor::NumberFormatConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> NumberFormatConstructor::initialize(Realm& realm)
void NumberFormatConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -32,8 +32,6 @@ ThrowCompletionOr<void> NumberFormatConstructor::initialize(Realm& realm)
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
return {};
}
// 15.1.1 Intl.NumberFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.numberformat

View file

@ -15,7 +15,7 @@ class NumberFormatConstructor final : public NativeFunction {
JS_OBJECT(NumberFormatConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~NumberFormatConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -22,15 +22,13 @@ NumberFormatFunction::NumberFormatFunction(NumberFormat& number_format, Object&
{
}
ThrowCompletionOr<void> NumberFormatFunction::initialize(Realm& realm)
void NumberFormatFunction::initialize(Realm& realm)
{
auto& vm = this->vm();
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable);
return {};
}
ThrowCompletionOr<Value> NumberFormatFunction::call()

View file

@ -19,7 +19,7 @@ public:
static NonnullGCPtr<NumberFormatFunction> create(Realm&, NumberFormat&);
virtual ~NumberFormatFunction() override = default;
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -19,14 +19,14 @@ NumberFormatPrototype::NumberFormatPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> NumberFormatPrototype::initialize(Realm& realm)
void NumberFormatPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 15.3.2 Intl.NumberFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.numberformat.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.NumberFormat"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.NumberFormat"sv)), Attribute::Configurable);
define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable);
@ -35,8 +35,6 @@ ThrowCompletionOr<void> NumberFormatPrototype::initialize(Realm& realm)
define_native_function(realm, vm.names.formatRange, format_range, 2, attr);
define_native_function(realm, vm.names.formatRangeToParts, format_range_to_parts, 2, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 15.3.3 get Intl.NumberFormat.prototype.format, https://tc39.es/ecma402/#sec-intl.numberformat.prototype.format

View file

@ -15,7 +15,7 @@ class NumberFormatPrototype final : public PrototypeObject<NumberFormatPrototype
JS_PROTOTYPE_OBJECT(NumberFormatPrototype, NumberFormat, Intl.NumberFormat);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~NumberFormatPrototype() override = default;
private:

View file

@ -21,9 +21,9 @@ PluralRulesConstructor::PluralRulesConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> PluralRulesConstructor::initialize(Realm& realm)
void PluralRulesConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -33,8 +33,6 @@ ThrowCompletionOr<void> PluralRulesConstructor::initialize(Realm& realm)
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
return {};
}
// 16.1.1 Intl.PluralRules ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.pluralrules

View file

@ -14,7 +14,7 @@ class PluralRulesConstructor final : public NativeFunction {
JS_OBJECT(PluralRulesConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~PluralRulesConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -18,21 +18,19 @@ PluralRulesPrototype::PluralRulesPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> PluralRulesPrototype::initialize(Realm& realm)
void PluralRulesPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Object::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 16.3.2 Intl.PluralRules.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.pluralrules.prototype-tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.PluralRules"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.PluralRules"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.select, select, 1, attr);
define_native_function(realm, vm.names.selectRange, select_range, 2, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 16.3.3 Intl.PluralRules.prototype.select ( value ), https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.select

View file

@ -15,7 +15,7 @@ class PluralRulesPrototype final : public PrototypeObject<PluralRulesPrototype,
JS_PROTOTYPE_OBJECT(PluralRulesPrototype, PluralRules, Intl.PluralRules);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~PluralRulesPrototype() override = default;
private:

View file

@ -24,9 +24,9 @@ RelativeTimeFormatConstructor::RelativeTimeFormatConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> RelativeTimeFormatConstructor::initialize(Realm& realm)
void RelativeTimeFormatConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -36,8 +36,6 @@ ThrowCompletionOr<void> RelativeTimeFormatConstructor::initialize(Realm& realm)
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
return {};
}
// 17.1.1 Intl.RelativeTimeFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat

View file

@ -14,7 +14,7 @@ class RelativeTimeFormatConstructor final : public NativeFunction {
JS_OBJECT(RelativeTimeFormatConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~RelativeTimeFormatConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -16,21 +16,19 @@ RelativeTimeFormatPrototype::RelativeTimeFormatPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> RelativeTimeFormatPrototype::initialize(Realm& realm)
void RelativeTimeFormatPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Object::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 17.3.2 Intl.RelativeTimeFormat.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype-toStringTag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.RelativeTimeFormat"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.RelativeTimeFormat"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.format, format, 2, attr);
define_native_function(realm, vm.names.formatToParts, format_to_parts, 2, attr);
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
return {};
}
// 17.3.3 Intl.RelativeTimeFormat.prototype.format ( value, unit ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format

View file

@ -15,7 +15,7 @@ class RelativeTimeFormatPrototype final : public PrototypeObject<RelativeTimeFor
JS_PROTOTYPE_OBJECT(RelativeTimeFormatPrototype, RelativeTimeFormat, Intl.RelativeTimeFormat);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~RelativeTimeFormatPrototype() override = default;
private:

View file

@ -18,19 +18,17 @@ SegmentIteratorPrototype::SegmentIteratorPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> SegmentIteratorPrototype::initialize(Realm& realm)
void SegmentIteratorPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Object::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 18.6.2.2 %SegmentIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma402/#sec-%segmentiteratorprototype%.@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Segmenter String Iterator"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Segmenter String Iterator"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.next, next, 0, attr);
return {};
}
// 18.6.2.1 %SegmentIteratorPrototype%.next ( ), https://tc39.es/ecma402/#sec-%segmentiteratorprototype%.next

View file

@ -15,7 +15,7 @@ class SegmentIteratorPrototype final : public PrototypeObject<SegmentIteratorPro
JS_PROTOTYPE_OBJECT(SegmentIteratorPrototype, SegmentIterator, SegmentIterator);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~SegmentIteratorPrototype() override = default;
private:

View file

@ -21,9 +21,9 @@ SegmenterConstructor::SegmenterConstructor(Realm& realm)
{
}
ThrowCompletionOr<void> SegmenterConstructor::initialize(Realm& realm)
void SegmenterConstructor::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
@ -33,8 +33,6 @@ ThrowCompletionOr<void> SegmenterConstructor::initialize(Realm& realm)
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
return {};
}
// 18.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter

View file

@ -14,7 +14,7 @@ class SegmenterConstructor final : public NativeFunction {
JS_OBJECT(SegmenterConstructor, NativeFunction);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~SegmenterConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;

View file

@ -17,20 +17,18 @@ SegmenterPrototype::SegmenterPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> SegmenterPrototype::initialize(Realm& realm)
void SegmenterPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
// 18.3.2 Intl.Segmenter.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.segmenter.prototype-@@tostringtag
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Segmenter"sv)), Attribute::Configurable);
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.Segmenter"sv)), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr);
define_native_function(realm, vm.names.segment, segment, 1, attr);
return {};
}
// 18.3.4 Intl.Segmenter.prototype.resolvedOptions ( ), https://tc39.es/ecma402/#sec-intl.segmenter.prototype.resolvedoptions

View file

@ -15,7 +15,7 @@ class SegmenterPrototype final : public PrototypeObject<SegmenterPrototype, Segm
JS_PROTOTYPE_OBJECT(SegmenterPrototype, Segmenter, Segmenter);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~SegmenterPrototype() override = default;
private:

View file

@ -17,17 +17,15 @@ SegmentsPrototype::SegmentsPrototype(Realm& realm)
{
}
ThrowCompletionOr<void> SegmentsPrototype::initialize(Realm& realm)
void SegmentsPrototype::initialize(Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
Base::initialize(realm);
auto& vm = this->vm();
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(realm, vm.well_known_symbol_iterator(), symbol_iterator, 0, attr);
define_native_function(realm, vm.names.containing, containing, 1, attr);
return {};
}
// 18.5.2.1 %SegmentsPrototype%.containing ( index ), https://tc39.es/ecma402/#sec-%segmentsprototype%.containing

View file

@ -15,7 +15,7 @@ class SegmentsPrototype final : public PrototypeObject<SegmentsPrototype, Segmen
JS_PROTOTYPE_OBJECT(SegmentsPrototype, Segments, Segments);
public:
virtual ThrowCompletionOr<void> initialize(Realm&) override;
virtual void initialize(Realm&) override;
virtual ~SegmentsPrototype() override = default;
private: