mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibJS: Add all the Error subclasses
This patch adds instance, constructor and prototype classes for: - EvalError - InternalError - RangeError - ReferenceError - SyntaxError - TypeError - URIError Enumerator macros are used to reduce the amount of typing. :^)
This commit is contained in:
parent
df7b617ba1
commit
58ab76269c
11 changed files with 157 additions and 7 deletions
|
@ -57,6 +57,11 @@ Interpreter::Interpreter()
|
|||
m_date_prototype = heap().allocate<DatePrototype>();
|
||||
m_number_prototype = heap().allocate<NumberPrototype>();
|
||||
m_boolean_prototype = heap().allocate<BooleanPrototype>();
|
||||
|
||||
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
|
||||
m_##snake_case##_prototype = heap().allocate<TitleCase##Prototype>();
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE_ERROR_SUBCLASS
|
||||
}
|
||||
|
||||
Interpreter::~Interpreter()
|
||||
|
@ -178,12 +183,18 @@ void Interpreter::gather_roots(Badge<Heap>, HashTable<Cell*>& roots)
|
|||
roots.set(m_string_prototype);
|
||||
roots.set(m_object_prototype);
|
||||
roots.set(m_array_prototype);
|
||||
roots.set(m_error_prototype);
|
||||
roots.set(m_date_prototype);
|
||||
roots.set(m_function_prototype);
|
||||
roots.set(m_number_prototype);
|
||||
roots.set(m_boolean_prototype);
|
||||
|
||||
roots.set(m_error_prototype);
|
||||
|
||||
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
|
||||
roots.set(m_##snake_case##_prototype);
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE_ERROR_SUBCLASS
|
||||
|
||||
roots.set(m_exception);
|
||||
|
||||
if (m_last_value.is_cell())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue