mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +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:
@@ -62,8 +62,8 @@ Value ErrorConstructor::construct(Interpreter& interpreter)
|
||||
ConstructorName::ConstructorName() \
|
||||
: NativeFunction(*interpreter().global_object().function_prototype()) \
|
||||
{ \
|
||||
define_property("prototype", interpreter().global_object().snake_name##_prototype(), 0); \
|
||||
define_property("length", Value(1), Attribute::Configurable); \
|
||||
define_property("prototype", interpreter().global_object().snake_name##_prototype(), 0); \
|
||||
define_property("length", Value(1), Attribute::Configurable); \
|
||||
} \
|
||||
ConstructorName::~ConstructorName() { } \
|
||||
Value ConstructorName::call(Interpreter& interpreter) \
|
||||
@@ -78,7 +78,7 @@ Value ErrorConstructor::construct(Interpreter& interpreter)
|
||||
if (interpreter.exception()) \
|
||||
return {}; \
|
||||
} \
|
||||
return ClassName::create(interpreter.global_object(), message); \
|
||||
return ClassName::create(global_object(), message); \
|
||||
}
|
||||
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
|
||||
Reference in New Issue
Block a user