mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +00:00
LibJS: Move Object::invoke to Value::invoke and fix it for primitives
This is a tiny difference and only changes anything for primitives in strict mode. However this is tested in test262 and can be noticed by overriding toString of primitive values. This does now require one to wrap an object in a Value to call invoke but all code using invoke has been migrated.
This commit is contained in:
parent
74e6a70958
commit
151447bdf7
12 changed files with 61 additions and 76 deletions
|
@ -163,4 +163,16 @@ inline GlobalObject* Shape::global_object() const
|
|||
template<>
|
||||
inline bool Object::fast_is<GlobalObject>() const { return is_global_object(); }
|
||||
|
||||
template<typename... Args>
|
||||
[[nodiscard]] ALWAYS_INLINE Value Value::invoke(GlobalObject& global_object, PropertyName const& property_name, Args... args)
|
||||
{
|
||||
if constexpr (sizeof...(Args) > 0) {
|
||||
MarkedValueList arglist { global_object.vm().heap() };
|
||||
(..., arglist.append(move(args)));
|
||||
return invoke_internal(global_object, property_name, move(arglist));
|
||||
}
|
||||
|
||||
return invoke_internal(global_object, property_name, Optional<MarkedValueList> {});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue