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:
Andreas Kling 2020-06-20 13:55:34 +02:00
parent 4aa98052ca
commit e4add19915
Notes: sideshowbarker 2024-07-19 05:32:11 +09:00
79 changed files with 541 additions and 519 deletions

View file

@ -130,7 +130,7 @@ Value ScriptFunction::construct(Interpreter& interpreter)
return call(interpreter);
}
Value ScriptFunction::length_getter(Interpreter& interpreter)
JS_DEFINE_NATIVE_GETTER(ScriptFunction::length_getter)
{
auto* function = script_function_from(interpreter);
if (!function)
@ -138,7 +138,7 @@ Value ScriptFunction::length_getter(Interpreter& interpreter)
return Value(static_cast<i32>(function->m_function_length));
}
Value ScriptFunction::name_getter(Interpreter& interpreter)
JS_DEFINE_NATIVE_GETTER(ScriptFunction::name_getter)
{
auto* function = script_function_from(interpreter);
if (!function)