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:
davidot 2021-08-09 16:45:43 +02:00 committed by Linus Groh
commit 151447bdf7
Notes: sideshowbarker 2024-07-18 07:11:14 +09:00
12 changed files with 61 additions and 76 deletions

View file

@ -290,9 +290,14 @@ public:
bool operator==(Value const&) const;
template<typename... Args>
[[nodiscard]] ALWAYS_INLINE Value invoke(GlobalObject& global_object, PropertyName const& property_name, Args... args);
private:
Type m_type { Type::Empty };
[[nodiscard]] Value invoke_internal(GlobalObject& global_object, PropertyName const&, Optional<MarkedValueList> arguments);
i32 to_i32_slow_case(GlobalObject&) const;
union {