2021-07-06 19:14:47 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
2021-07-14 21:01:12 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/CalendarConstructor.h>
|
2021-07-15 23:20:43 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/DurationConstructor.h>
|
2021-07-07 17:41:37 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/InstantConstructor.h>
|
2021-07-06 19:33:20 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/Now.h>
|
2021-07-19 00:29:26 +03:00
|
|
|
#include <LibJS/Runtime/Temporal/PlainDateConstructor.h>
|
2021-07-22 19:47:07 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/PlainDateTimeConstructor.h>
|
2021-07-28 18:36:52 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/PlainTimeConstructor.h>
|
2021-08-07 22:40:32 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/PlainYearMonthConstructor.h>
|
2021-07-06 19:14:47 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/Temporal.h>
|
2021-07-06 23:53:27 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/TimeZoneConstructor.h>
|
2021-08-01 17:20:11 +01:00
|
|
|
#include <LibJS/Runtime/Temporal/ZonedDateTimeConstructor.h>
|
2021-07-06 19:14:47 +01:00
|
|
|
|
|
|
|
|
namespace JS::Temporal {
|
|
|
|
|
|
|
|
|
|
// 1 The Temporal Object, https://tc39.es/proposal-temporal/#sec-temporal-objects
|
|
|
|
|
Temporal::Temporal(GlobalObject& global_object)
|
|
|
|
|
: Object(*global_object.object_prototype())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Temporal::initialize(GlobalObject& global_object)
|
|
|
|
|
{
|
|
|
|
|
Object::initialize(global_object);
|
2021-07-06 19:33:20 +01:00
|
|
|
|
|
|
|
|
auto& vm = this->vm();
|
|
|
|
|
|
2021-07-27 18:47:23 +01:00
|
|
|
// 1.1.1 Temporal [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-@@tostringtag
|
2021-08-08 21:31:44 +01:00
|
|
|
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal"), Attribute::Configurable);
|
2021-07-27 18:47:23 +01:00
|
|
|
|
|
|
|
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
2021-07-19 00:25:22 +01:00
|
|
|
define_direct_property(vm.names.Now, heap().allocate<Now>(global_object, global_object), attr);
|
2021-07-14 21:01:12 +01:00
|
|
|
define_direct_property(vm.names.Calendar, global_object.temporal_calendar_constructor(), attr);
|
2021-07-15 23:20:43 +01:00
|
|
|
define_direct_property(vm.names.Duration, global_object.temporal_duration_constructor(), attr);
|
2021-07-07 17:41:37 +01:00
|
|
|
define_direct_property(vm.names.Instant, global_object.temporal_instant_constructor(), attr);
|
2021-07-19 00:29:26 +03:00
|
|
|
define_direct_property(vm.names.PlainDate, global_object.temporal_plain_date_constructor(), attr);
|
2021-07-22 19:47:07 +01:00
|
|
|
define_direct_property(vm.names.PlainDateTime, global_object.temporal_plain_date_time_constructor(), attr);
|
2021-07-28 18:36:52 +01:00
|
|
|
define_direct_property(vm.names.PlainTime, global_object.temporal_plain_time_constructor(), attr);
|
2021-08-07 22:40:32 +01:00
|
|
|
define_direct_property(vm.names.PlainYearMonth, global_object.temporal_plain_year_month_constructor(), attr);
|
2021-07-06 23:53:27 +01:00
|
|
|
define_direct_property(vm.names.TimeZone, global_object.temporal_time_zone_constructor(), attr);
|
2021-08-01 17:20:11 +01:00
|
|
|
define_direct_property(vm.names.ZonedDateTime, global_object.temporal_zoned_date_time_constructor(), attr);
|
2021-07-06 19:14:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|