LibJS: Implement the Temporal.Duration constructor

This also includes a stubbed Temporal.Duration.prototype.

Until we have re-implemented Temporal.PlainDate/ZonedDateTime, some of
Temporal.Duration.compare (and its invoked AOs) are left unimplemented.
This commit is contained in:
Timothy Flynn 2024-11-18 11:58:51 -05:00 committed by Tim Flynn
commit 5fe0d3352d
Notes: github-actions[bot] 2024-11-21 00:06:22 +00:00
30 changed files with 2143 additions and 26 deletions

View file

@ -6,6 +6,7 @@
*/
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Temporal/DurationConstructor.h>
#include <LibJS/Runtime/Temporal/Temporal.h>
namespace JS::Temporal {
@ -26,6 +27,9 @@ void Temporal::initialize(Realm& realm)
// 1.1.1 Temporal [ %Symbol.toStringTag% ], https://tc39.es/proposal-temporal/#sec-temporal-%symbol.tostringtag%
define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, "Temporal"_string), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_intrinsic_accessor(vm.names.Duration, attr, [](auto& realm) -> Value { return realm.intrinsics().temporal_duration_constructor(); });
}
}