1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +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

@ -26,6 +26,15 @@
#pragma once
#define JS_ENUMERATE_ERROR_SUBCLASSES \
__JS_ENUMERATE_ERROR_SUBCLASS(EvalError, eval_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(InternalError, internal_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(RangeError, range_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(ReferenceError, reference_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(SyntaxError, syntax_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(TypeError, type_error) \
__JS_ENUMERATE_ERROR_SUBCLASS(URIError, uri_error)
namespace JS {
class ASTNode;
@ -54,6 +63,13 @@ class Statement;
class Value;
enum class DeclarationKind;
#define __JS_ENUMERATE_ERROR_SUBCLASS(TitleCase, snake_case) \
class TitleCase; \
class TitleCase##Constructor; \
class TitleCase##Prototype;
JS_ENUMERATE_ERROR_SUBCLASSES
#undef __JS_ENUMERATE_ERROR_SUBCLASS
struct Argument;
template<class T>