mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibJS: Use enumerator macros for boilerplate code around native types
This commit is contained in:
parent
0bdfb952c5
commit
cb0dfd8f72
11 changed files with 124 additions and 170 deletions
|
@ -136,22 +136,15 @@ public:
|
|||
|
||||
Shape* empty_object_shape() { return m_empty_object_shape; }
|
||||
|
||||
Object* string_prototype() { return m_string_prototype; }
|
||||
Object* object_prototype() { return m_object_prototype; }
|
||||
Object* array_prototype() { return m_array_prototype; }
|
||||
Object* date_prototype() { return m_date_prototype; }
|
||||
Object* function_prototype() { return m_function_prototype; }
|
||||
Object* number_prototype() { return m_number_prototype; }
|
||||
Object* boolean_prototype() { return m_boolean_prototype; }
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
Object* snake_name##_prototype() { return m_##snake_name##_prototype; }
|
||||
JS_ENUMERATE_BUILTIN_TYPES
|
||||
#undef __JS_ENUMERATE
|
||||
|
||||
Object* error_prototype() { return m_error_prototype; }
|
||||
|
||||
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
|
||||
Object* snake_case##_prototype() { return m_##snake_case##_prototype; }
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE_ERROR_SUBCLASS
|
||||
|
||||
Exception* exception() { return m_exception; }
|
||||
Exception* exception()
|
||||
{
|
||||
return m_exception;
|
||||
}
|
||||
void clear_exception() { m_exception = nullptr; }
|
||||
|
||||
template<typename T, typename... Args>
|
||||
|
@ -180,21 +173,12 @@ private:
|
|||
|
||||
Shape* m_empty_object_shape { nullptr };
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
Object* m_##snake_name##_prototype { nullptr };
|
||||
JS_ENUMERATE_BUILTIN_TYPES
|
||||
#undef __JS_ENUMERATE
|
||||
|
||||
Object* m_global_object { nullptr };
|
||||
Object* m_string_prototype { nullptr };
|
||||
Object* m_object_prototype { nullptr };
|
||||
Object* m_array_prototype { nullptr };
|
||||
Object* m_date_prototype { nullptr };
|
||||
Object* m_function_prototype { nullptr };
|
||||
Object* m_number_prototype { nullptr };
|
||||
Object* m_boolean_prototype { nullptr };
|
||||
|
||||
Object* m_error_prototype { nullptr };
|
||||
|
||||
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
|
||||
Object* m_##snake_case##_prototype;
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE_ERROR_SUBCLASS
|
||||
|
||||
Exception* m_exception { nullptr };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue