mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
LibJS: Rework how native functions are called to improve |this| value
Native functions now only get the Interpreter& as an argument. They can then extract |this| along with any indexed arguments it wants from it. This forces functions that want |this| to actually deal with calling interpreter.this_value().to_object(), and dealing with the possibility of a non-object |this|. This is still not great but let's keep massaging it forward.
This commit is contained in:
parent
c209ea1985
commit
7c4e53f31e
25 changed files with 145 additions and 102 deletions
|
@ -46,7 +46,7 @@ public:
|
|||
virtual Optional<Value> get_own_property(const Object& this_object, const FlyString& property_name) const;
|
||||
virtual bool put_own_property(Object& this_object, const FlyString& property_name, Value);
|
||||
|
||||
void put_native_function(const FlyString& property_name, AK::Function<Value(Object*, Vector<Value>)>);
|
||||
void put_native_function(const FlyString& property_name, AK::Function<Value(Interpreter&)>);
|
||||
void put_native_property(const FlyString& property_name, AK::Function<Value(Object*)> getter, AK::Function<void(Object*, Value)> setter);
|
||||
|
||||
virtual bool is_error() const { return false; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue