2020-03-07 18:42:11 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-06-20 11:55:34 +00:00
|
|
|
#define JS_DECLARE_NATIVE_FUNCTION(name) \
|
|
|
|
static JS::Value name(JS::Interpreter&, JS::GlobalObject&)
|
|
|
|
|
|
|
|
#define JS_DECLARE_NATIVE_GETTER(name) \
|
|
|
|
static JS::Value name(JS::Interpreter&, JS::GlobalObject&)
|
|
|
|
|
|
|
|
#define JS_DECLARE_NATIVE_SETTER(name) \
|
|
|
|
static void name(JS::Interpreter&, JS::GlobalObject&, JS::Value)
|
|
|
|
|
|
|
|
#define JS_DEFINE_NATIVE_FUNCTION(name) \
|
|
|
|
JS::Value name([[maybe_unused]] JS::Interpreter& interpreter, [[maybe_unused]] JS::GlobalObject& global_object)
|
|
|
|
|
|
|
|
#define JS_DEFINE_NATIVE_GETTER(name) \
|
|
|
|
JS::Value name([[maybe_unused]] JS::Interpreter& interpreter, [[maybe_unused]] JS::GlobalObject& global_object)
|
|
|
|
|
|
|
|
#define JS_DEFINE_NATIVE_SETTER(name) \
|
|
|
|
void name([[maybe_unused]] JS::Interpreter& interpreter, [[maybe_unused]] JS::GlobalObject& global_object, JS::Value value)
|
|
|
|
|
2020-04-10 12:06:52 +00:00
|
|
|
#define JS_ENUMERATE_NATIVE_OBJECTS \
|
|
|
|
__JS_ENUMERATE(Array, array, ArrayPrototype, ArrayConstructor) \
|
2020-06-06 00:14:10 +00:00
|
|
|
__JS_ENUMERATE(BigIntObject, bigint, BigIntPrototype, BigIntConstructor) \
|
2020-04-10 12:06:52 +00:00
|
|
|
__JS_ENUMERATE(BooleanObject, boolean, BooleanPrototype, BooleanConstructor) \
|
|
|
|
__JS_ENUMERATE(Date, date, DatePrototype, DateConstructor) \
|
|
|
|
__JS_ENUMERATE(Error, error, ErrorPrototype, ErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(Function, function, FunctionPrototype, FunctionConstructor) \
|
|
|
|
__JS_ENUMERATE(NumberObject, number, NumberPrototype, NumberConstructor) \
|
|
|
|
__JS_ENUMERATE(Object, object, ObjectPrototype, ObjectConstructor) \
|
2020-06-03 21:34:52 +00:00
|
|
|
__JS_ENUMERATE(ProxyObject, proxy, ProxyPrototype, ProxyConstructor) \
|
2020-06-03 23:05:49 +00:00
|
|
|
__JS_ENUMERATE(RegExpObject, regexp, RegExpPrototype, RegExpConstructor) \
|
2020-04-30 06:25:21 +00:00
|
|
|
__JS_ENUMERATE(StringObject, string, StringPrototype, StringConstructor) \
|
|
|
|
__JS_ENUMERATE(SymbolObject, symbol, SymbolPrototype, SymbolConstructor)
|
2020-04-10 12:06:52 +00:00
|
|
|
|
|
|
|
#define JS_ENUMERATE_ERROR_SUBCLASSES \
|
|
|
|
__JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(TypeError, type_error, TypeErrorPrototype, TypeErrorConstructor) \
|
|
|
|
__JS_ENUMERATE(URIError, uri_error, URIErrorPrototype, URIErrorConstructor)
|
|
|
|
|
2020-07-09 21:58:20 +00:00
|
|
|
#define JS_ENUMERATE_ITERATOR_PROTOTYPES \
|
|
|
|
__JS_ENUMERATE(Iterator, iterator) \
|
|
|
|
__JS_ENUMERATE(ArrayIterator, array_iterator)
|
|
|
|
|
2020-04-10 12:06:52 +00:00
|
|
|
#define JS_ENUMERATE_BUILTIN_TYPES \
|
|
|
|
JS_ENUMERATE_NATIVE_OBJECTS \
|
|
|
|
JS_ENUMERATE_ERROR_SUBCLASSES
|
2020-04-10 10:42:33 +00:00
|
|
|
|
2020-03-07 18:42:11 +00:00
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class ASTNode;
|
2020-06-06 00:14:10 +00:00
|
|
|
class BigInt;
|
2020-04-19 20:03:02 +00:00
|
|
|
class BoundFunction;
|
2020-03-08 18:23:58 +00:00
|
|
|
class Cell;
|
2020-04-19 09:30:47 +00:00
|
|
|
class DeferGC;
|
2020-03-24 13:37:39 +00:00
|
|
|
class Error;
|
2020-03-24 21:03:50 +00:00
|
|
|
class Exception;
|
2020-03-11 18:27:43 +00:00
|
|
|
class Expression;
|
2020-05-21 18:14:23 +00:00
|
|
|
class Accessor;
|
2020-04-01 19:04:42 +00:00
|
|
|
class GlobalObject;
|
2020-03-18 19:03:17 +00:00
|
|
|
class HandleImpl;
|
2020-03-08 18:23:58 +00:00
|
|
|
class Heap;
|
|
|
|
class HeapBlock;
|
2020-03-07 18:42:11 +00:00
|
|
|
class Interpreter;
|
2020-04-15 19:58:22 +00:00
|
|
|
class LexicalEnvironment;
|
2020-04-19 15:24:56 +00:00
|
|
|
class MarkedValueList;
|
2020-06-23 15:56:57 +00:00
|
|
|
class NativeProperty;
|
2020-03-11 17:55:01 +00:00
|
|
|
class PrimitiveString;
|
2020-04-27 10:10:16 +00:00
|
|
|
class Reference;
|
2020-03-07 18:42:11 +00:00
|
|
|
class ScopeNode;
|
2020-04-02 17:32:21 +00:00
|
|
|
class Shape;
|
2020-03-23 15:46:41 +00:00
|
|
|
class Statement;
|
2020-04-30 06:25:21 +00:00
|
|
|
class Symbol;
|
2020-05-25 19:24:46 +00:00
|
|
|
class Token;
|
2020-04-21 21:46:51 +00:00
|
|
|
class Uint8ClampedArray;
|
2020-03-07 18:42:11 +00:00
|
|
|
class Value;
|
2020-04-08 09:59:18 +00:00
|
|
|
enum class DeclarationKind;
|
2020-03-07 18:42:11 +00:00
|
|
|
|
2020-04-10 12:06:52 +00:00
|
|
|
#define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \
|
|
|
|
class ClassName; \
|
|
|
|
class ConstructorName; \
|
|
|
|
class PrototypeName;
|
|
|
|
JS_ENUMERATE_BUILTIN_TYPES
|
|
|
|
#undef __JS_ENUMERATE
|
2020-04-10 10:42:33 +00:00
|
|
|
|
2020-04-04 08:46:00 +00:00
|
|
|
struct Argument;
|
|
|
|
|
2020-03-18 19:03:17 +00:00
|
|
|
template<class T>
|
|
|
|
class Handle;
|
|
|
|
|
2020-03-07 18:42:11 +00:00
|
|
|
}
|