diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/GlobalObject.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/GlobalObject.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 75db91487a..5f3acbcab2 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -133,6 +133,18 @@ void GlobalObject::initialize_global_object() JS_ENUMERATE_BUILTIN_TYPES #undef __JS_ENUMERATE +#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ + if (!m_temporal_##snake_name##_prototype) \ + m_temporal_##snake_name##_prototype = heap().allocate<Temporal::PrototypeName>(*this, *this); + JS_ENUMERATE_TEMPORAL_OBJECTS +#undef __JS_ENUMERATE + + // Must be allocated before `Temporal::Temporal` below. +#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ + initialize_constructor(vm.names.ClassName, m_temporal_##snake_name##_constructor, m_temporal_##snake_name##_prototype); + JS_ENUMERATE_TEMPORAL_OBJECTS +#undef __JS_ENUMERATE + u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.gc, gc, 0, attr); define_native_function(vm.names.isNaN, is_nan, 1, attr); @@ -235,6 +247,12 @@ void GlobalObject::visit_edges(Visitor& visitor) JS_ENUMERATE_BUILTIN_TYPES #undef __JS_ENUMERATE +#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ + visitor.visit(m_temporal_##snake_name##_constructor); \ + visitor.visit(m_temporal_##snake_name##_prototype); + JS_ENUMERATE_TEMPORAL_OBJECTS +#undef __JS_ENUMERATE + #define __JS_ENUMERATE(ClassName, snake_name) \ visitor.visit(m_##snake_name##_prototype); JS_ENUMERATE_ITERATOR_PROTOTYPES |