mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
This commit is contained in:
parent
1c1b902a6a
commit
2692db8699
694 changed files with 1774 additions and 1065 deletions
|
@ -16,9 +16,9 @@ CalendarConstructor::CalendarConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CalendarConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> CalendarConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -29,6 +29,8 @@ void CalendarConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.from, from, 1, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 12.2.1 Temporal.Calendar ( id ), https://tc39.es/proposal-temporal/#sec-temporal.calendar
|
||||
|
|
|
@ -14,7 +14,7 @@ class CalendarConstructor final : public NativeFunction {
|
|||
JS_OBJECT(CalendarConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~CalendarConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -29,9 +29,9 @@ CalendarPrototype::CalendarPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CalendarPrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> CalendarPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -65,6 +65,8 @@ void CalendarPrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toJSON, to_json, 0, attr);
|
||||
define_native_function(realm, vm.names.era, era, 1, attr);
|
||||
define_native_function(realm, vm.names.eraYear, era_year, 1, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 12.4.3 get Temporal.Calendar.prototype.id, https://tc39.es/proposal-temporal/#sec-get-temporal.calendar.prototype.id
|
||||
|
|
|
@ -15,7 +15,7 @@ class CalendarPrototype final : public PrototypeObject<CalendarPrototype, Calend
|
|||
JS_PROTOTYPE_OBJECT(CalendarPrototype, Calendar, Temporal.Calendar);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~CalendarPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,9 +19,9 @@ DurationConstructor::DurationConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DurationConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> DurationConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -33,6 +33,8 @@ void DurationConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 7.1.1 Temporal.Duration ( [ years [ , months [ , weeks [ , days [ , hours [ , minutes [ , seconds [ , milliseconds [ , microseconds [ , nanoseconds ] ] ] ] ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.duration
|
||||
|
|
|
@ -14,7 +14,7 @@ class DurationConstructor final : public NativeFunction {
|
|||
JS_OBJECT(DurationConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~DurationConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -20,9 +20,9 @@ DurationPrototype::DurationPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DurationPrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> DurationPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -54,6 +54,8 @@ void DurationPrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toJSON, to_json, 0, attr);
|
||||
define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr);
|
||||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 7.3.3 get Temporal.Duration.prototype.years, https://tc39.es/proposal-temporal/#sec-get-temporal.duration.prototype.years
|
||||
|
|
|
@ -15,7 +15,7 @@ class DurationPrototype final : public PrototypeObject<DurationPrototype, Durati
|
|||
JS_PROTOTYPE_OBJECT(DurationPrototype, Duration, Temporal.Duration);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~DurationPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,9 +18,9 @@ InstantConstructor::InstantConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void InstantConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> InstantConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -36,6 +36,8 @@ void InstantConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 8.1.1 Temporal.Instant ( epochNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal.instant
|
||||
|
|
|
@ -14,7 +14,7 @@ class InstantConstructor final : public NativeFunction {
|
|||
JS_OBJECT(InstantConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~InstantConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -24,9 +24,9 @@ InstantPrototype::InstantPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void InstantPrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> InstantPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -51,6 +51,8 @@ void InstantPrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
define_native_function(realm, vm.names.toZonedDateTime, to_zoned_date_time, 1, attr);
|
||||
define_native_function(realm, vm.names.toZonedDateTimeISO, to_zoned_date_time_iso, 1, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 8.3.3 get Temporal.Instant.prototype.epochSeconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochseconds
|
||||
|
|
|
@ -15,7 +15,7 @@ class InstantPrototype final : public PrototypeObject<InstantPrototype, Instant>
|
|||
JS_PROTOTYPE_OBJECT(InstantPrototype, Instant, Temporal.Instant);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~InstantPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,9 +26,9 @@ Now::Now(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void Now::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> Now::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -45,6 +45,8 @@ void Now::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.plainDate, plain_date, 1, attr);
|
||||
define_native_function(realm, vm.names.plainDateISO, plain_date_iso, 0, attr);
|
||||
define_native_function(realm, vm.names.plainTimeISO, plain_time_iso, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 2.2.1 Temporal.Now.timeZone ( ), https://tc39.es/proposal-temporal/#sec-temporal.now.timezone
|
||||
|
|
|
@ -15,7 +15,7 @@ class Now final : public Object {
|
|||
JS_OBJECT(Now, Object);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~Now() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,9 +20,9 @@ PlainDateConstructor::PlainDateConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainDateConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainDateConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -34,6 +34,8 @@ void PlainDateConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(3), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 3.1.1 Temporal.PlainDate ( isoYear, isoMonth, isoDay [ , calendarLike ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate
|
||||
|
|
|
@ -14,7 +14,7 @@ class PlainDateConstructor final : public NativeFunction {
|
|||
JS_OBJECT(PlainDateConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainDateConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -25,9 +25,9 @@ PlainDatePrototype::PlainDatePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainDatePrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainDatePrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -68,6 +68,8 @@ void PlainDatePrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr);
|
||||
define_native_function(realm, vm.names.toJSON, to_json, 0, attr);
|
||||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 3.3.3 get Temporal.PlainDate.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class PlainDatePrototype final : public PrototypeObject<PlainDatePrototype, Plai
|
|||
JS_PROTOTYPE_OBJECT(PlainDatePrototype, PlainDate, Temporal.PlainDate);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainDatePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,9 +20,9 @@ PlainDateTimeConstructor::PlainDateTimeConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainDateTimeConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainDateTimeConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -34,6 +34,8 @@ void PlainDateTimeConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(3), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 5.1.1 Temporal.PlainDateTime ( isoYear, isoMonth, isoDay [ , hour [ , minute [ , second [ , millisecond [ , microsecond [ , nanosecond [ , calendarLike ] ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime
|
||||
|
|
|
@ -14,7 +14,7 @@ class PlainDateTimeConstructor final : public NativeFunction {
|
|||
JS_OBJECT(PlainDateTimeConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainDateTimeConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -26,9 +26,9 @@ PlainDateTimePrototype::PlainDateTimePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainDateTimePrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainDateTimePrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -79,6 +79,8 @@ void PlainDateTimePrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toPlainMonthDay, to_plain_month_day, 0, attr);
|
||||
define_native_function(realm, vm.names.toPlainTime, to_plain_time, 0, attr);
|
||||
define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 5.3.3 get Temporal.PlainDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class PlainDateTimePrototype final : public PrototypeObject<PlainDateTimePrototy
|
|||
JS_PROTOTYPE_OBJECT(PlainDateTimePrototype, PlainDateTime, Temporal.PlainDateTime);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainDateTimePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,9 +19,9 @@ PlainMonthDayConstructor::PlainMonthDayConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainMonthDayConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainMonthDayConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -32,6 +32,8 @@ void PlainMonthDayConstructor::initialize(Realm& realm)
|
|||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, vm.names.from, from, 1, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 10.1.1 Temporal.PlainMonthDay ( isoMonth, isoDay [ , calendarLike [ , referenceISOYear ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday
|
||||
|
|
|
@ -14,7 +14,7 @@ class PlainMonthDayConstructor final : public NativeFunction {
|
|||
JS_OBJECT(PlainMonthDayConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainMonthDayConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -20,9 +20,9 @@ PlainMonthDayPrototype::PlainMonthDayPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainMonthDayPrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainMonthDayPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -42,6 +42,8 @@ void PlainMonthDayPrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
define_native_function(realm, vm.names.toPlainDate, to_plain_date, 1, attr);
|
||||
define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 10.3.3 get Temporal.PlainMonthDay.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plainmonthday.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class PlainMonthDayPrototype final : public PrototypeObject<PlainMonthDayPrototy
|
|||
JS_PROTOTYPE_OBJECT(PlainMonthDayPrototype, PlainMonthDay, Temporal.PlainMonthDay);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainMonthDayPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,9 +18,9 @@ PlainTimeConstructor::PlainTimeConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainTimeConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainTimeConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -32,6 +32,8 @@ void PlainTimeConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 4.1.1 Temporal.PlainTime ( [ hour [ , minute [ , second [ , millisecond [ , microsecond [ , nanosecond ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime
|
||||
|
|
|
@ -14,7 +14,7 @@ class PlainTimeConstructor final : public NativeFunction {
|
|||
JS_OBJECT(PlainTimeConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainTimeConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -25,9 +25,9 @@ PlainTimePrototype::PlainTimePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainTimePrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainTimePrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -57,6 +57,8 @@ void PlainTimePrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr);
|
||||
define_native_function(realm, vm.names.toJSON, to_json, 0, attr);
|
||||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 4.3.3 get Temporal.PlainTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaintime.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class PlainTimePrototype final : public PrototypeObject<PlainTimePrototype, Plai
|
|||
JS_PROTOTYPE_OBJECT(PlainTimePrototype, PlainTime, Temporal.PlainTime);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainTimePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,9 +20,9 @@ PlainYearMonthConstructor::PlainYearMonthConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainYearMonthConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainYearMonthConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -34,6 +34,8 @@ void PlainYearMonthConstructor::initialize(Realm& realm)
|
|||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, vm.names.from, from, 1, attr);
|
||||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 9.1.1 Temporal.PlainYearMonth ( isoYear, isoMonth [ , calendarLike [ , referenceISODay ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth
|
||||
|
|
|
@ -14,7 +14,7 @@ class PlainYearMonthConstructor final : public NativeFunction {
|
|||
JS_OBJECT(PlainYearMonthConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainYearMonthConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -22,9 +22,9 @@ PlainYearMonthPrototype::PlainYearMonthPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void PlainYearMonthPrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> PlainYearMonthPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -55,6 +55,8 @@ void PlainYearMonthPrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
|
||||
define_native_function(realm, vm.names.toPlainDate, to_plain_date, 1, attr);
|
||||
define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 9.3.3 get Temporal.PlainYearMonth.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class PlainYearMonthPrototype final : public PrototypeObject<PlainYearMonthProto
|
|||
JS_PROTOTYPE_OBJECT(PlainYearMonthPrototype, PlainYearMonth, Temporal.PlainYearMonth);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~PlainYearMonthPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,9 +26,9 @@ Temporal::Temporal(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void Temporal::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> Temporal::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -47,6 +47,8 @@ void Temporal::initialize(Realm& realm)
|
|||
define_intrinsic_accessor(vm.names.PlainYearMonth, attr, [](auto& realm) -> Value { return realm.intrinsics().temporal_plain_year_month_constructor(); });
|
||||
define_intrinsic_accessor(vm.names.TimeZone, attr, [](auto& realm) -> Value { return realm.intrinsics().temporal_time_zone_constructor(); });
|
||||
define_intrinsic_accessor(vm.names.ZonedDateTime, attr, [](auto& realm) -> Value { return realm.intrinsics().temporal_zoned_date_time_constructor(); });
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Temporal final : public Object {
|
|||
JS_OBJECT(Temporal, Object);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~Temporal() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,9 +17,9 @@ TimeZoneConstructor::TimeZoneConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void TimeZoneConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> TimeZoneConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -30,6 +30,8 @@ void TimeZoneConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.from, from, 1, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 11.2.1 Temporal.TimeZone ( identifier ), https://tc39.es/proposal-temporal/#sec-temporal.timezone
|
||||
|
|
|
@ -14,7 +14,7 @@ class TimeZoneConstructor final : public NativeFunction {
|
|||
JS_OBJECT(TimeZoneConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~TimeZoneConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -23,9 +23,9 @@ TimeZonePrototype::TimeZonePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void TimeZonePrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> TimeZonePrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -43,6 +43,8 @@ void TimeZonePrototype::initialize(Realm& realm)
|
|||
|
||||
// 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, "Temporal.TimeZone"), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 11.4.3 get Temporal.TimeZone.prototype.id, https://tc39.es/proposal-temporal/#sec-get-temporal.timezone.prototype.id
|
||||
|
|
|
@ -15,7 +15,7 @@ class TimeZonePrototype final : public PrototypeObject<TimeZonePrototype, TimeZo
|
|||
JS_PROTOTYPE_OBJECT(TimeZonePrototype, TimeZone, Temporal.TimeZone);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~TimeZonePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,9 +21,9 @@ ZonedDateTimeConstructor::ZonedDateTimeConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ZonedDateTimeConstructor::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> ZonedDateTimeConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -35,6 +35,8 @@ void ZonedDateTimeConstructor::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.compare, compare, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 6.1.1 Temporal.ZonedDateTime ( epochNanoseconds, timeZoneLike [ , calendarLike ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime
|
||||
|
|
|
@ -14,7 +14,7 @@ class ZonedDateTimeConstructor final : public NativeFunction {
|
|||
JS_OBJECT(ZonedDateTimeConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~ZonedDateTimeConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -26,9 +26,9 @@ ZonedDateTimePrototype::ZonedDateTimePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ZonedDateTimePrototype::initialize(Realm& realm)
|
||||
ThrowCompletionOr<void> ZonedDateTimePrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -90,6 +90,8 @@ void ZonedDateTimePrototype::initialize(Realm& realm)
|
|||
define_native_function(realm, vm.names.toPlainYearMonth, to_plain_year_month, 0, attr);
|
||||
define_native_function(realm, vm.names.toPlainMonthDay, to_plain_month_day, 0, attr);
|
||||
define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// 6.3.3 get Temporal.ZonedDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.calendar
|
||||
|
|
|
@ -15,7 +15,7 @@ class ZonedDateTimePrototype final : public PrototypeObject<ZonedDateTimePrototy
|
|||
JS_PROTOTYPE_OBJECT(ZonedDateTimePrototype, ZonedDateTime, Temporal.ZonedDateTime);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual ~ZonedDateTimePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue