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

LibJS: Implement and use the MakeMethod AO

Two direct uses of the set_home_object() setter remain, we should fix
those up and remove it eventually.
This commit is contained in:
Linus Groh 2021-12-29 10:33:46 +01:00
parent df931e6a83
commit 7204b292c5
3 changed files with 14 additions and 3 deletions

View file

@ -294,6 +294,15 @@ void ECMAScriptFunctionObject::visit_edges(Visitor& visitor)
}
}
// 10.2.7 MakeMethod ( F, homeObject ), https://tc39.es/ecma262/#sec-makemethod
void ECMAScriptFunctionObject::make_method(Object& home_object)
{
// 1. Set F.[[HomeObject]] to homeObject.
m_home_object = &home_object;
// 2. Return NormalCompletion(undefined).
}
// 10.2.11 FunctionDeclarationInstantiation ( func, argumentsList ), https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantiation(Interpreter* interpreter)
{

View file

@ -37,6 +37,8 @@ public:
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override;
virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override;
void make_method(Object& home_object);
Statement const& ecmascript_code() const { return m_ecmascript_code; }
Vector<FunctionNode::Parameter> const& formal_parameters() const { return m_formal_parameters; };