1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

LibJS: Rename Function => FunctionObject

This commit is contained in:
Andreas Kling 2021-06-27 21:48:34 +02:00
parent e389ae3c97
commit ba9d5c4d54
114 changed files with 263 additions and 262 deletions

View file

@ -45,7 +45,7 @@ struct ScopeFrame {
struct ExecutionContext {
const ASTNode* current_node { nullptr };
FlyString function_name;
Function* function { nullptr };
FunctionObject* function { nullptr };
Value this_value;
Vector<Value> arguments;
Array* arguments_object { nullptr };
@ -224,14 +224,14 @@ public:
return throw_exception(global_object, T::create(global_object, String::formatted(type.message(), forward<Args>(args)...)));
}
Value construct(Function&, Function& new_target, Optional<MarkedValueList> arguments);
Value construct(FunctionObject&, FunctionObject& new_target, Optional<MarkedValueList> arguments);
String join_arguments(size_t start_index = 0) const;
Value get_new_target();
template<typename... Args>
[[nodiscard]] ALWAYS_INLINE Value call(Function& function, Value this_value, Args... args)
[[nodiscard]] ALWAYS_INLINE Value call(FunctionObject& function, Value this_value, Args... args)
{
if constexpr (sizeof...(Args) > 0) {
MarkedValueList arglist { heap() };
@ -259,7 +259,7 @@ public:
private:
VM();
[[nodiscard]] Value call_internal(Function&, Value this_value, Optional<MarkedValueList> arguments);
[[nodiscard]] Value call_internal(FunctionObject&, Value this_value, Optional<MarkedValueList> arguments);
Exception* m_exception { nullptr };
@ -294,13 +294,13 @@ private:
};
template<>
[[nodiscard]] ALWAYS_INLINE Value VM::call(Function& function, Value this_value, MarkedValueList arguments) { return call_internal(function, this_value, move(arguments)); }
[[nodiscard]] ALWAYS_INLINE Value VM::call(FunctionObject& function, Value this_value, MarkedValueList arguments) { return call_internal(function, this_value, move(arguments)); }
template<>
[[nodiscard]] ALWAYS_INLINE Value VM::call(Function& function, Value this_value, Optional<MarkedValueList> arguments) { return call_internal(function, this_value, move(arguments)); }
[[nodiscard]] ALWAYS_INLINE Value VM::call(FunctionObject& function, Value this_value, Optional<MarkedValueList> arguments) { return call_internal(function, this_value, move(arguments)); }
template<>
[[nodiscard]] ALWAYS_INLINE Value VM::call(Function& function, Value this_value) { return call(function, this_value, Optional<MarkedValueList> {}); }
[[nodiscard]] ALWAYS_INLINE Value VM::call(FunctionObject& function, Value this_value) { return call(function, this_value, Optional<MarkedValueList> {}); }
ALWAYS_INLINE Heap& Cell::heap() const
{