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

LibJS: Implement Temporal[@@toStringTag]

This commit is contained in:
Linus Groh 2021-07-27 18:47:23 +01:00
parent 3a4d3b15e3
commit b3723a88a6
2 changed files with 7 additions and 1 deletions

View file

@ -27,8 +27,11 @@ void Temporal::initialize(GlobalObject& global_object)
Object::initialize(global_object); Object::initialize(global_object);
auto& vm = this->vm(); auto& vm = this->vm();
u8 attr = Attribute::Writable | Attribute::Configurable;
// 1.1.1 Temporal [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal"), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_direct_property(vm.names.Now, heap().allocate<Now>(global_object, global_object), attr); define_direct_property(vm.names.Now, heap().allocate<Now>(global_object, global_object), attr);
define_direct_property(vm.names.Calendar, global_object.temporal_calendar_constructor(), attr); define_direct_property(vm.names.Calendar, global_object.temporal_calendar_constructor(), attr);
define_direct_property(vm.names.Duration, global_object.temporal_duration_constructor(), attr); define_direct_property(vm.names.Duration, global_object.temporal_duration_constructor(), attr);

View file

@ -0,0 +1,3 @@
test("basic functionality", () => {
expect(Temporal[Symbol.toStringTag]).toBe("Temporal");
});