diff options
Diffstat (limited to 'Libraries/LibJS/Runtime/GlobalObject.h')
-rw-r--r-- | Libraries/LibJS/Runtime/GlobalObject.h | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/Libraries/LibJS/Runtime/GlobalObject.h b/Libraries/LibJS/Runtime/GlobalObject.h index 101403003a..14f7bcf530 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Libraries/LibJS/Runtime/GlobalObject.h @@ -35,18 +35,10 @@ public: explicit GlobalObject(); virtual ~GlobalObject() override; - ArrayConstructor* array_constructor() { return m_array_constructor; } - BooleanConstructor* boolean_constructor() { return m_boolean_constructor; } - DateConstructor* date_constructor() { return m_date_constructor; } - FunctionConstructor* function_constructor() { return m_function_constructor; } - NumberConstructor* number_constructor() { return m_number_constructor; }; - ObjectConstructor* object_constructor() { return m_object_constructor; } - ErrorConstructor* error_constructor() { return m_error_constructor; } - -#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \ - TitleCase##Constructor* snake_case##_constructor() { return m_##snake_case##_constructor; } - JS_ENUMERATE_ERROR_SUBCLASSES -#undef __JS_ENUMERATE_ERROR_SUBCLASS +#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ + ConstructorName* snake_name##_constructor() { return m_##snake_name##_constructor; } + JS_ENUMERATE_BUILTIN_TYPES +#undef __JS_ENUMERATE protected: virtual void visit_children(Visitor&) override; @@ -60,18 +52,10 @@ private: template<typename ConstructorType> void add_constructor(const FlyString& property_name, ConstructorType*&, Object& prototype); - ArrayConstructor* m_array_constructor { nullptr }; - BooleanConstructor* m_boolean_constructor { nullptr }; - DateConstructor* m_date_constructor { nullptr }; - FunctionConstructor* m_function_constructor { nullptr }; - NumberConstructor* m_number_constructor { nullptr }; - ObjectConstructor* m_object_constructor { nullptr }; - ErrorConstructor* m_error_constructor { nullptr }; - -#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \ - TitleCase##Constructor* m_##snake_case##_constructor; - JS_ENUMERATE_ERROR_SUBCLASSES -#undef __JS_ENUMERATE_ERROR_SUBCLASS +#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ + ConstructorName* m_##snake_name##_constructor { nullptr }; + JS_ENUMERATE_BUILTIN_TYPES +#undef __JS_ENUMERATE }; } |