mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:45:07 +00:00
LibJS: Pass "this" as an Object* to NativeFunction callbacks
Instead of every NativeFunction callback having to ask the Interpreter for the current "this" value and then converting it to an Object etc, just pass "this" as an Object* directly.
This commit is contained in:
parent
3163929990
commit
63b3cfdc73
9 changed files with 28 additions and 26 deletions
|
@ -63,7 +63,7 @@ void Object::put(String property_name, Value value)
|
|||
m_properties.set(property_name, move(value));
|
||||
}
|
||||
|
||||
void Object::put_native_function(String property_name, AK::Function<Value(Interpreter&, Vector<Value>)> native_function)
|
||||
void Object::put_native_function(String property_name, AK::Function<Value(Object*, Vector<Value>)> native_function)
|
||||
{
|
||||
put(property_name, heap().allocate<NativeFunction>(move(native_function)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue