mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS: Pass GlobalObject& to native functions and property accessors
More work towards supporting multiple global objects. Native C++ code now get a GlobalObject& and don't have to ask the Interpreter for it. I've added macros for declaring and defining native callbacks since this was pretty tedious and this makes it easier next time we want to change any of these signatures.
This commit is contained in:
parent
4aa98052ca
commit
e4add19915
79 changed files with 541 additions and 519 deletions
|
@ -26,6 +26,24 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#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)
|
||||
|
||||
#define JS_ENUMERATE_NATIVE_OBJECTS \
|
||||
__JS_ENUMERATE(Array, array, ArrayPrototype, ArrayConstructor) \
|
||||
__JS_ENUMERATE(BigIntObject, bigint, BigIntPrototype, BigIntConstructor) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue