1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:22:07 +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:
Andreas Kling 2020-04-10 12:42:33 +02:00
parent df7b617ba1
commit 58ab76269c
11 changed files with 157 additions and 7 deletions

View file

@ -40,4 +40,16 @@ Error::~Error()
{
}
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
TitleCase::TitleCase(const String& message) \
: Error(#TitleCase, message) \
{ \
set_prototype(interpreter().snake_case##_prototype()); \
} \
TitleCase::~TitleCase() {} \
const char* TitleCase::class_name() const { return #TitleCase; }
JS_ENUMERATE_ERROR_SUBCLASSES
#undef __JS_ENUMERATE_ERROR_SUBCLASS
}